PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Paste As Plain Text Does Not Play Well With Sticky Keys

Open NeilN1 opened this issue 3 years ago • 4 comments

Microsoft PowerToys version

0.71.0

Installation method

PowerToys auto-update

Running as admin

No

Area(s) with issue?

Paste as Plain Text

Steps to reproduce

Have Sticky Keys set up like the following:

Screenshot 2023-07-24 130402

Select text to copy with a Ctrl+C Go to a Notepad doc (or anything that allows you to paste) Press and release each key in this sequence one at a time: WinKey, Ctrl, Alt, v Plain text is pasted but every modifier key is stickied (without visual indication it's stickied). Every modifier key has to be now tapped three times to unsticky.

✔️ Expected Behavior

No keys should be stickied after text is pasted.

❌ Actual Behavior

Every modifier key is stickied

Other Software

Windows 11 Pro 22H2 Build 22621.1992

NeilN1 avatar Jul 24 '23 17:07 NeilN1

Duplicate of #25678, see my last comment there.

turribeach avatar Jul 06 '24 09:07 turribeach

Is this planned on being solved? I've encountered this issue for a couple of years now but everything seems to be a duplicate of something...

trenzterra avatar Apr 27 '26 00:04 trenzterra

Diagnostic follow-up for Advanced Paste / direct Paste as plain text: Alt+Win+V leaves LAlt and LWin logically down, on PowerToys 0.101.2362.0. Related to #43220, #42471 and #50127. Windows Sticky Keys are disabled in the stored settings in this case.

Trigger and recovery reported by the user

The user initially noticed Alt/Win sticking while switching input language (Win+Space) or windows. During observation they clarified that it happens mainly after Advanced Paste's Paste as plain text shortcut, Alt+Win+V. The saved Advanced Paste setting confirms paste-as-plain-hotkey = {win:true, ctrl:false, alt:true, shift:false, code:86}.

Pressing and releasing the affected Alt/Win key again clears the symptom. Reproduction is intermittent; no claim of a 100% minimal repro. Keyboard Manager is enabled, with LWin+V → LCtrl+V (exactMatch=false), CapsLock → LCtrl, and LWin+Tab → LAlt+Tab among its mappings. An isolation run with Keyboard Manager disabled was not performed.

Incident captured on 2026-10-16 (MSK = UTC+03:00)

Time Evidence
13:23:04.729, 13:23:06.865, 13:23:28.121, 13:23:35.041 Native Advanced Paste log records direct Paste as plain text activations.
Approximately 13:23:42 User reports “stuck” during the live observation. This is report receipt time, not precise physical onset.
13:23:47.353 Another direct Paste as plain text activation is logged; this occurs after the user report and before the snapshot.
13:23:55.773 One-shot GetAsyncKeyState snapshot: LWin=true, LAlt=true; RWin/RAlt/LCtrl/RCtrl/LShift/RShift=false. Foreground process WindowsTerminal; layout 0x0419.
13:24:39.128 Next snapshot: all eight modifiers false. Keyboard Manager retains the same PID.

The snapshot establishes logical state. Physical release and the exact recovery moment were not independently recorded, so these two samples do not establish the duration of a continuous stuck interval.

Second user-reported episode, around 13:43:23: the native log records direct plain-text activations at 13:43:19.520 and 13:43:21.616. The user explicitly confirmed they had already cleared the latch before sending the second report. The snapshot at 13:43:24.454 shows all modifiers up, consistent with that recovery. Another paste activation at 13:43:24.225 occurred after report receipt and is not presented as the cause of the preceding episode. Thus two episodes were reported, with a down-state snapshot available for the first and a post-recovery snapshot for the second.

Native Advanced Paste log around the incident
[2026-10-16 13:23:04.729173] [p-19572] [t-29472] [trace] Paste as plain text hotkey pressed
[2026-10-16 13:23:06.864565] [p-19572] [t-29472] [trace] Paste as plain text hotkey pressed
[2026-10-16 13:23:28.120925] [p-19572] [t-29472] [trace] Paste as plain text hotkey pressed
[2026-10-16 13:23:35.040635] [p-19572] [t-29472] [trace] Paste as plain text hotkey pressed
[2026-10-16 13:23:47.352917] [p-19572] [t-29472] [trace] Paste as plain text hotkey pressed

Environment and observation

  • Windows 11 Enterprise 25H2 x64, build 26200.9457; UI en-US, culture ru-RU.
  • PowerToys elevated; Keyboard Manager engine elevated, priority RealTime.
  • Logi Options+ 2.9.994631 and Kaspersky Endpoint Security for Windows 14.0.0.504 are present. Their presence does not establish a conflict.
  • Stored accessibility flags: StickyKeys=506, FilterKeys=126, ToggleKeys=62 (enabled bit unset).
  • Enabled PowerToys: AdvancedPaste, CmdPal, File Explorer, Keyboard Manager, TextExtractor. AltWindowCycle, GrabAndMove, MouseWithoutBorders, QuickAccent and Shortcut Guide are disabled.
  • Completed. Native Keyboard Manager/Runner log and process observation: 13:09:55–14:09:51 MSK, 59.93 minutes between process samples; 716 samples, maximum gap 10.104 s.
  • Keyboard Manager: 1 distinct PID(s), absent in 0 samples; 114 new engine log lines.
  • Advanced Paste: 22 direct plain-text activations in the same time window, recovered from the native log (its dedicated watcher started after the incident).
  • Advanced Paste native ModuleInterface and Keyboard Manager engine: 0 warning/error/critical/fatal lines. Runner separately logged 10 errors while loading disabled-module settings (got malformed json for CmdNotFound, EnvironmentVariables, FancyZones, Hosts and NewPlus, at 13:24:38 and 13:24:54). Those lines occur after the reported incident and do not establish its cause.
  • Windows Application event log: 0 events mentioning PowerToys/KeyboardManager since the observation began.
  • 0 Keyboard Manager/general setting changes and 0 Advanced Paste hotkey changes after their respective baselines. Clean module logs do not exclude incorrect modifier restoration.

Specific code path to investigate — hypothesis, not proven incident cause

In the source for the installed release, the direct action runs on a detached worker. try_inject_modifier_key_restore samples GetAsyncKeyState and queues modifier key-down events; try_to_paste_as_plain_text sends that batch afterwards (restore list around lines 857–864, SendInput around 873).

A possible ordering is: the worker queues Win/Alt restores while they read down; physical key-up is processed before batch submission; the batch then reasserts Win/Alt without a subsequent physical key-up. This is consistent with the snapshot and tap-to-clear symptom, but the required ordering was not captured. Please instrument restore decisions and requested/sent input counts, and test release timing and interaction with Keyboard Manager's Win+V remap. A successful SendInput count alone would not exclude stale restoration.

Collection limits

The initial raw/low-level modifier-only observer stopped almost immediately; Kaspersky logged events for its script and the script disappeared. No exclusions or protection changes were made. Native-log/process collection continued. One-shot logical-state snapshots succeeded. A separate observer polled only the eight modifiers about every 100 ms from 13:25:34 to 13:41:18, without installing hooks or injecting input. At 13:41:18 Kaspersky logged events for that script too; its process exited with code 21 and the script disappeared. It was not restarted. Its final LWin=true sample is not evidence of a continuing latch, because subsequent samples are unavailable. The polling can miss short transitions and cannot distinguish physical holds from logical latching. No typed text, window titles or clipboard contents were read by these observers.

Complete active Keyboard Manager mappings (all shortcuts global, exactMatch=false)
Input Output
CapsLock LCtrl
LWin+Tab LAlt+Tab
LWin+A LCtrl+A
LWin+C LCtrl+C
LWin+F LCtrl+F
LWin+Q RAlt+F4
LWin+S LCtrl+S
LWin+T LCtrl+T
LWin+V LCtrl+V
LWin+X LCtrl+X
LWin+Y LCtrl+Y
LWin+Z LCtrl+Z
LWin+LShift+C LCtrl+LShift+C
LWin+LShift+T LCtrl+LShift+T
LWin+LShift+V LCtrl+LShift+V

No app-specific/text/program-launch remaps are configured.

Expected: after direct plain-text paste and release of the physical shortcut, Alt and Win must not remain logically held. Sanitized local evidence includes native logs, both incident snapshots, modifier-state polling, shortcut settings and observation statistics; this comment includes the incident and results. No full-machine diagnostic archive is uploaded.

Vlad3mar avatar Oct 16 '26 11:10 Vlad3mar

Came here after all the other tickets keep getting closed as duplicates (25678, 33773). Nudging this to see if someone can take a look at it please. Analysis from Vlad3mar above sounds feasible - just a timing issue between pressing the keys and a key getting held down (in software, not physically) - so seems like it shouldn't be too difficult to fix this? Please! :P

Also just to note that "Steps to reproduce" at the top are not the same for me - I do not have sticky keys enabled - so not sure if these are two separate issues or the same thing and Sticky keys is irrelevant?

dantek12345 avatar Nov 17 '26 00:11 dantek12345