Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure focus visible is set before sync blur event #3721

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

diegohaz
Copy link
Member

@diegohaz diegohaz commented Apr 23, 2024

Here we were setting the data-focus-visible attribute asynchronously in a microtask on the focus capture event:

if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
queueMicrotask(applyFocusVisible);
}

However, when a blur event was immediately dispatched right after focus, the data-focus-visible attribute would be set after the blur event, leaving the element in an incorrect focus visible state.

Copy link

changeset-bot bot commented Apr 23, 2024

🦋 Changeset detected

Latest commit: ca90f66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@ariakit/react-core Patch
@ariakit/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Apr 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@diegohaz diegohaz merged commit 5184460 into main Apr 23, 2024
16 checks passed
@diegohaz diegohaz deleted the focusable-sync-focus-visible branch April 23, 2024 08:42
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.

None yet

1 participant