Skip to content

Conversation

@far-fetched
Copy link
Contributor

What changed and Why ?

I noticed strange behavior using firefox for <Listbox /> component:

Clicking on button when list is open – it does not close listbox:

simplescreenrecorder-2022-05-27_08.43.34.mp4

With transition, clicking on button when list is open – it closes the listbox, but to open it again you have to click twice

simplescreenrecorder-2022-05-27_08.43.54.mp4

You can check out our examples: link
Remember to use firefox

Code fix:

Problem seems to be with using non-standard property path on JS event. More here. I changed a bit of logic to use closest method, which supposed to be extensively compatible with browsers:

Zrzut ekranu z 2022-05-27 09-06-28

After fix:

simplescreenrecorder-2022-05-27_08.48.38.mp4
simplescreenrecorder-2022-05-27_08.48.52.mp4

When executing test (using firefox) which asserts close - it fails.

PS: We already have 37 errors when executing test suite with firefox ;( I will try to fix them in following PR's !

@far-fetched far-fetched changed the title refactor handle outside click for listbox 🐛 Refactor handle outside click for listbox - firefox issue May 27, 2022
@far-fetched
Copy link
Contributor Author

@dmcnamara-eng I would like to hear your voice here, as you are main author of this component, thanks !

@far-fetched far-fetched force-pushed the close-listbox-on-button-click-firefox branch from 77d504e to 003ea8d Compare June 1, 2022 06:48
@dmcnamara-eng dmcnamara-eng self-requested a review June 1, 2022 13:07
Copy link
Collaborator

@dmcnamara-eng dmcnamara-eng left a comment

Choose a reason for hiding this comment

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

Turns out Event.composedPath is the cross browser equivalent of Event.path.

It's not quite functionally equivalent to closest() but in this case achieves the same result.

Looks good to merge 👍

@NullVoxPopuli
Copy link
Collaborator

LGTM! thanks for submitting this!

@NullVoxPopuli NullVoxPopuli merged commit e748b39 into GavinJoyce:master Jun 1, 2022
@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants