fix: resolve Enter key not activating focused non-default dialog buttons#308735
Open
maruthang wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: resolve Enter key not activating focused non-default dialog buttons#308735maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang wants to merge 1 commit intomicrosoft:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
src/vs/base/test/browser/ui/dialog/dialog.test.tsthat verifies Enter on a focused non-default button resolves with the correct button index