Skip to content

fix: resolve Enter key not activating focused non-default dialog buttons#308735

Open
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-239062-force-checkout-enter-key
Open

fix: resolve Enter key not activating focused non-default dialog buttons#308735
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-239062-force-checkout-enter-key

Conversation

@maruthang
Copy link
Copy Markdown
Contributor

Summary

Fixes #239062

Bug: Pressing Enter on the "Force Checkout" button (or any non-default focused button) in a dialog did not activate that button.

Root Cause: The Dialog class's Enter key handler only handled the case where an input field had focus (resolving with button index 0). When a non-default button had focus, Enter fell through to default handling and did nothing.

Fix: Added explicit Enter key handling in the Dialog class to detect when a non-default button has focus and resolve the dialog with that button's index.

Changes

  • src/vs/base/browser/ui/dialog/dialog.ts: Added a check after the existing input-focus handling to iterate over the button bar's buttons and resolve with the focused button's index when Enter is pressed.
  • src/vs/base/test/browser/ui/dialog/dialog.test.ts (new): Added regression tests verifying that Enter activates the correct focused button in multi-button dialogs.

Test Plan

  • Added regression test in src/vs/base/test/browser/ui/dialog/dialog.test.ts that verifies Enter on a focused non-default button resolves with the correct button index
  • All existing tests pass
  • Manual verification: open a dialog with multiple buttons (e.g. the "Force Checkout" confirmation), tab to a non-default button, and press Enter — the focused button should now activate

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.

Keyboard Enter for "Force Checkout" not working

2 participants