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

Constrained tabbing: fix unstable behavior in firefox #42653

Merged
merged 5 commits into from
Nov 24, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/compose/src/hooks/use-constrained-tabbing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ function useConstrainedTabbing() {

trap.tabIndex = -1;
node[ domAction ]( trap );

// Remove itself when the trap loses focus.
trap.addEventListener( 'blur', () => node.removeChild( trap ) );

trap.focus();
// Remove after the browser moves focus to the next element.
timeoutId = setTimeout( () => node.removeChild( trap ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this timeout is not used any longer, the variable declaration at line 36 and the clearTimeout at line 75 should be removed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed by 11a1cfa

}

node.addEventListener( 'keydown', onKeyDown );
Expand Down