Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

DropList: onDropListLeave #978

Merged
merged 6 commits into from Sep 10, 2021
Merged

DropList: onDropListLeave #978

merged 6 commits into from Sep 10, 2021

Conversation

tinkertrain
Copy link
Collaborator

@tinkertrain tinkertrain commented Sep 10, 2021

Feature

Adds a callback onDropListLeave that gets fired when:

  • Blur ouf toggler only when the next focused element is not the DropList Menu
  • Blur out of Menu (only when the next focused element is not the toggler)
  • Click outside

Also tweaks some behaviours:

  • If focusTogglerOnMenuClose is false:
    • Selecting an item still focuses the toggler if closeOnSelect is true
    • Pressing esc also focuses the toggler

Tests

  • For some reason there was some duplicated tests... oops
  • At the beginning the use of waitFor was needed everytime the menu was open/close, I think with some of the refactoring I did later on, this became unnecesary, so I cleaned up the tests.

@netlify
Copy link

netlify bot commented Sep 10, 2021

✔️ Deploy Preview for hsds-react ready!

🔨 Explore the source changes: fb3477e

🔍 Inspect the deploy log: https://app.netlify.com/sites/hsds-react/deploys/613b50747c9af200072bff6d

😎 Browse the preview: https://deploy-preview-978--hsds-react.netlify.app

Copy link
Collaborator

@jakubjanczyk jakubjanczyk left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@tinkertrain tinkertrain merged commit fb3477e into master Sep 10, 2021
@tinkertrain tinkertrain deleted the enhancement/droplist-leave branch September 10, 2021 12:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants