Repository navigation
Conversation
Closing a dialog returns focus to where it opened from. A focus request made in the same render, such as a palette command focusing an editor, ran before that and lost. Inputs, text surfaces, terminals and focusable elements now apply focus requests after the frame's other deferred work.
Enter in a dialog ran gpui-component's confirm action, which closed the dialog and, after its close animation, put focus back where the dialog opened from. A palette command that focused an editor lost focus, and Enter in a form field inside a dialog closed the dialog and discarded the form. GPUI dialogs have no confirm action: the app owns their open state, and Escape and the close button still dismiss them.
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
Keep explicit focus requests made while a dialog closes, rather than letting the dialog's restoration overwrite them. Inputs, text surfaces, and other native focusable elements use the shared post-frame focus path.
Enter inside a dialog belongs to its content: an input may submit, but the application decides whether to set
open: false. Escape, close buttons, and configured overlay dismissal continue to request closure.This extracts Chris McCord's two dialog fixes. It is based directly on upstream main and does not require terminal PR #9 or value-drag PR #10.
Evidence
All nine native navigation regressions pass. They exercise an open palette submitting an input and focusing a different input as it closes, continued editing after Enter when it stays open, and existing Escape closure/focus restoration. The repository quality gate passes.
Compatibility
Intentional behavior change: consumers relying on Enter to dismiss a dialog must explicitly close it after successful submission. This prevents failed validation or content submission from discarding an open form. The public dialog docs and changelog describe the contract.
No dependency, schema, or package-version changes. OS-level focus/keyboard delivery across platforms was not validated; coverage uses the deterministic native harness.