-
Notifications
You must be signed in to change notification settings - Fork 930
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
useCombobox
selects highlightedIndex
on browser tab change
#1471
Comments
It appears to happen only on tab switch. Maybe the condition in Thank you for reporting this! It's quite a corner case, as it involves both mouse and keyboard + the tab switch. I really cannot imagine this scenario occurring, but if we can fix it, then we should! |
Thanks @silviuaavram! Agree it's a bit of an edge case but would be good to solve if possible. I've done some more investigating into this issue and the problem is that the A potential solution could be to also rely on the This change could look something like this: - const inputHandleBlur = () => {
+ const inputHandleBlur = event => {
if (
latestState.isOpen &&
!mouseAndTouchTrackersRef.current.isMouseDown
) {
dispatch({
type: stateChangeTypes.InputBlur,
- selectItem: true,
+ selectItem: event.relativeTarget !== null,
})
}
} Keen to get your thoughts on this change, happy to help out with a PR 😄 |
Having the same issue, @aliceHendicott I think you confused two things. Should be - event.relativeTarget !== null
+ event.relativeTarget !== undefined
or what you are looking for - event.relativeTarget !== null
+ event.relatedTarget !== null
|
Thank you for looking into this! @aliceHendicott @Drewberrysteph anyone up to fix this in a PR? |
Thanks @Drewberrysteph! Must have been testing with @silviuaavram happy to do up a PR for this one 😄 I'm not sure the change is needed in |
… tab change Related issue - downshift-js#1471
Thank you for the PR! Looking forward to merging it! |
@all-contributors please add @aliceHendicott for code, bug |
I've put up a pull request to add @aliceHendicott! 🎉 |
🎉 This issue has been resolved in version 7.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
downshift
version: 7.2.0node
version: 16.19npm
(oryarn
) version: 1.22.10 (yarn
)What you did:
As decided in #1010,
InputBlur
action should returnselectedItem
only from Tab/Shift+Tab and not from clicking outside. As of v6, this change was made. However, if your click outside is to change browser tab, the currenthighlightedIndex
is selected when returning to the page.To reproduce (possible through the docs site):
Performing the same behaviour on the accessible example within the accessibility guidelines does not select the highlighted item.
Screen.Recording.2023-02-17.at.9.26.41.am.mov
Reproduction repository:
https://codesandbox.io/s/downshift-basic-example-7edw3k
The text was updated successfully, but these errors were encountered: