Skip to content

Clear stuck shortcut keys when the main window loses focus (#11548)#11967

Merged
niksedk merged 1 commit into
SubtitleEdit:mainfrom
muaz978:fix/shortcut-keys-stuck-after-dialog
Jun 29, 2026
Merged

Clear stuck shortcut keys when the main window loses focus (#11548)#11967
niksedk merged 1 commit into
SubtitleEdit:mainfrom
muaz978:fix/shortcut-keys-stuck-after-dialog

Conversation

@muaz978

@muaz978 muaz978 commented Jun 29, 2026

Copy link
Copy Markdown

Fixes #11548.

Problem: a modal dialog steals focus, so the KeyUp for keys held when it opened never reaches the main window and they stay 'down' in the shortcut manager. Most visibly: Ctrl+O on a changed file raises the 'Save changes?' prompt; after dismissing it, Ctrl+I (toggle italic), Find, Replace and every other shortcut stop matching (active set is still {Ctrl, O, …}). Reproduced on Linux per the issue.

Fix: clear the held-key state in OnWindowDeactivated, which already runs whenever the window loses focus (modal dialogs, Alt+Tab), so the set is empty again next time the window is active. One-line, cross-platform.

Developed on macOS; verified compiling via CI.

…dit#11548)

A modal dialog steals focus from the main window, so the KeyUp for any keys
held when it opened never reaches the main window's key handler and those keys
stay "down" in the shortcut manager. Most visibly: pressing Ctrl+O on a changed
file raises the "Save changes?" prompt; after dismissing it, Ctrl+I (toggle
italic), Find, Replace and every other shortcut stop matching, because the
active-key set is still {Ctrl, O, ...}. It only recovered via an action that
happened to call ClearKeys.

Clear the held-key state in OnWindowDeactivated, which already runs whenever the
window loses focus (modal dialogs, Alt+Tab), so the set is empty again the next
time the window is active.
@niksedk niksedk merged commit ca7349c into SubtitleEdit:main Jun 29, 2026
2 checks passed
@muaz978 muaz978 deleted the fix/shortcut-keys-stuck-after-dialog branch June 29, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toggle italic hotkey stops working

2 participants