Skip to content

Preserve requested focus and controlled dialog submission - #11

Open
jeregrine wants to merge 3 commits into
elixir-crab:mainfrom
jeregrine:dialog-focus-and-submit
Open

jeregrine wants to merge 3 commits into
elixir-crab:mainfrom
jeregrine:dialog-focus-and-submit

Conversation

@jeregrine

@jeregrine jeregrine commented Oct 19, 2026 •

Copy link
Copy Markdown

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.

chrismccord and others added 3 commits October 19, 2026 08:41
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.
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.

2 participants