Skip to content

fix: Fix bug that could cause focus to be lost in Chrome when dismissing a dropdown#9763

Merged
gonfunko merged 1 commit into
v13from
chrome-focus
Apr 24, 2026
Merged

fix: Fix bug that could cause focus to be lost in Chrome when dismissing a dropdown#9763
gonfunko merged 1 commit into
v13from
chrome-focus

Conversation

@gonfunko
Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #9759

Proposed Changes

This PR fixes a bug that caused focus to be lost/become passive on the element that spawned a dropdown when selecting an item in the dropdown or dismissing it on Chrome. This was because removal of elements from the DOM triggers focusout on Chrome, but not on Firefox and Safari, due to an ambiguity in the spec. That has since been resolved, but Chrome has not (yet?) updated its behavior. I inverted the order of returning ephemeral focus and removing the dropdowndiv from the dom, so that focus will have already been returned before the div is removed, and thus even though that still fires a focusout event the returnEphemeralFocus handler will have already been invoked and cleared by that point.

@gonfunko gonfunko requested a review from a team as a code owner April 24, 2026 16:02
@gonfunko gonfunko requested a review from mikeharv April 24, 2026 16:02
@github-actions github-actions Bot added the PR: fix Fixes a bug label Apr 24, 2026
@gonfunko gonfunko merged commit 3a14fcc into v13 Apr 24, 2026
8 of 9 checks passed
@gonfunko gonfunko deleted the chrome-focus branch April 24, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants