Skip to content

Don't override bare Left/Right when a text input is focused (#11357)#11403

Merged
niksedk merged 1 commit into
mainfrom
fix-arrow-keys-in-textbox-11357
Jun 4, 2026
Merged

Don't override bare Left/Right when a text input is focused (#11357)#11403
niksedk merged 1 commit into
mainfrom
fix-arrow-keys-in-textbox-11357

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented Jun 4, 2026

Summary

Bare Left/Right are fundamental caret navigation in every text input on every platform. The existing protection in OnKeyDownHandler only returned early when the Allow single-letter shortcuts in text box setting was off; with that setting on (or for an arrow key that the user has happened to bind), Left/Right inside the subtitle text box, the Find dialog, or any other TextBox / TextEditor / MaskedTextBox would fire the SE shortcut instead of moving the caret.

From the reporter (#11357):

When I am editing text in the text box, I want to use … LeftArrow to skip to the next/previous word. This is a global Windows standard keyboard shortcut that works in every other app.

Change

At the top of the IsTextInputFocused() branch in MainViewModel.OnKeyDownHandler (MainViewModel.cs:16764), bail out when the pressed key is bare Left or Right (no modifiers):

if ((keyEventArgs.Key == Key.Left || keyEventArgs.Key == Key.Right)
    && keyEventArgs.KeyModifiers == KeyModifiers.None)
{
    return;
}

Modified combinations (Ctrl+Left, Shift+Right, Ctrl+Shift+Left, etc.) keep going through the normal shortcut resolution — some users do bind those, and overriding them would surprise them.

The check uses the existing IsTextInputFocused() helper, so it applies broadly: subtitle text box, original text box, Find dialog, any future window with a text input.

Test plan

  • In Options → Settings → Tools, turn on Allow single-letter shortcuts in text box, bind Left arrow to "Video go back 1 second", click into the subtitle text box, press Left. Confirm the caret moves left and the video does NOT move.
  • Same setup, press Right. Caret moves right; video does not move.
  • Same setup, press Ctrl+Left. Ctrl+Left still triggers whatever shortcut the user has bound to it (if any), matching existing behavior for modifier combinations.
  • Bare Left/Right while the subtitle grid is focused still works as before (does whatever the user has bound to those keys).
  • Bare Left/Right inside the Find dialog still moves the caret.
  • Build clean; UI tests pass (306/306).

🤖 Generated with Claude Code

Bare Left/Right are fundamental caret navigation in every text input
on every platform. The existing protection in OnKeyDownHandler only
returned early when the "Allow single-letter shortcuts in text box"
setting was off; with that setting on (or for an arrow key that the
user has happened to bind), Left/Right inside the subtitle text box,
the Find dialog, or any other TextBox / TextEditor / MaskedTextBox
would fire the SE shortcut instead of moving the caret. From the
reporter:

> When I am editing text in the text box, I want to use … LeftArrow to
> skip to the next/previous word. This is a global Windows standard
> keyboard shortcut that works in every other app.

Bail out of OnKeyDownHandler when the focused element is a text input
and the pressed key is bare Left or Right (no modifiers). Modified
combinations (Ctrl+Left, Shift+Right, etc.) keep going through the
normal shortcut resolution because some users do bind those.

Fixes #11357

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@niksedk niksedk merged commit aa0f01b into main Jun 4, 2026
1 of 3 checks passed
@niksedk niksedk deleted the fix-arrow-keys-in-textbox-11357 branch June 4, 2026 19:59
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.

1 participant