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

fix(useCombobox): tab to body should select element #1517

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

silviuaavram
Copy link
Collaborator

@silviuaavram silviuaavram commented Jul 11, 2023

What:

Tabbing with an element highlighted should select that element, even if the combobox is the last element in the tab order and the focus ends up on body.

Why:
Fixes #1515

How:
The bug is a regression from #1484.

The fix in the PR above handles correctly the case when blur is performed by tab change, and in this case the element should not be selected. Blur by tab change is detected via event.relatedTarget === null. However, tabbing from the last element in the tab order also has event.relatedTarget === null so we need to distinguish between these two cases. The fix is to also check the environment.document.activeElement === environment.document.body.

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

@silviuaavram
Copy link
Collaborator Author

@aliceHendicott can you take a look at this as well, since it's related to your previous fix. Thank you! The issue is attached to the description.

@silviuaavram silviuaavram merged commit 1730fbe into master Jul 12, 2023
2 checks passed
@silviuaavram silviuaavram deleted the fix/tab-from-last-element branch July 12, 2023 06:38
@github-actions
Copy link

🎉 This PR is included in version 7.6.1 🎉

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.

useCombobox does not auto-select highlightedIndex after tab onBlur
1 participant