Skip to content

Focus the viewport when closing a dialog without previous focus - #13119

Open
hjanuschka wants to merge 1 commit into
whatwg:mainfrom
hjanuschka:fix-dialog-close-no-previous-focus
Open

hjanuschka wants to merge 1 commit into
whatwg:mainfrom
hjanuschka:fix-dialog-close-no-previous-focus

Conversation

@hjanuschka

@hjanuschka hjanuschka commented Oct 24, 2026 •

Copy link
Copy Markdown

When a dialog closes without a previously focused element, its current focus can remain inside the closed dialog until the asynchronous focus fixup runs. Focus the document's viewport synchronously if focus is still inside the dialog; leave focus elsewhere alone.

Fixes #13118.


/acknowledgements.html ( diff )
/interactive-elements.html ( diff )

When no element was focused before the dialog opened, closing it can
leave focus inside the closed dialog until asynchronous focus fixup.
Focus the viewport synchronously when focus is still inside the dialog.

Tests: https://chromium-review.googlesource.com/c/chromium/src/+/8644932

Fixes whatwg#13118.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Reset focus when closing a dialog with no previously focused element

1 participant