Skip to content

fix: tab retargeting if focus moved during keydown - #1296

Merged
snowystinger merged 5 commits into
testing-library:mainfrom
snowystinger:fix-tab-retargeting
Aug 18, 2026
Merged

fix: tab retargeting if focus moved during keydown#1296
snowystinger merged 5 commits into
testing-library:mainfrom
snowystinger:fix-tab-retargeting

Conversation

@snowystinger

Copy link
Copy Markdown
Contributor

What

Closes #1188

Why

This is how the browser behaves, if focus is moved during the keydown of "Tab", then focus is moved from the new activeElement

I came across this in our own repo while testing some new changes.
adobe/react-spectrum#8700

How

Instead of using event target, we used the known activeElement when determining where focus should move

Checklist

  • Documentation
  • Tests
  • Ready to be merged

@snowystinger

Copy link
Copy Markdown
Contributor Author

bump <3

@snowystinger
snowystinger merged commit 43efda7 into testing-library:main Aug 18, 2026
2 checks passed
@snowystinger
snowystinger deleted the fix-tab-retargeting branch August 18, 2026 03:26
@github-actions

Copy link
Copy Markdown

馃帀 This PR is included in version 14.6.5 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The keydown.Tab behaviour handler assumes that the event target will always be the origin for determining focus

1 participant