Skip to content

[FocusScope] Maintain trap when deleting focused element #2145

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

Merged
merged 3 commits into from
May 16, 2023

Conversation

benoitgrelard
Copy link
Contributor

Fixes #1498
Fixes #1605

if (!container.contains(event.relatedTarget as HTMLElement | null)) {
const relatedTarget = event.relatedTarget as HTMLElement | null;

// A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

@benoitgrelard benoitgrelard merged commit 8a60445 into main May 16, 2023
@benoitgrelard benoitgrelard deleted the focus-scope-deleted-active-element-fix branch May 16, 2023 17:11
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.

Removing focused element inside dialog or dropdown makes CPU spike in chrome. Focus trap lost when you click an item and remove it
2 participants