-
Notifications
You must be signed in to change notification settings - Fork 844
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
[EuiPopover] Support custom onClickOutside
overrides
#6500
Conversation
…peKey` - enabling consumers to not automatically close the popover, but instead (e.g.) trigger a confirmation that can keep the popover open
Preview documentation changes for this PR: https://eui.elastic.co/pr_6500/ |
- per a11y feedback
onClickOutside
and onEscapeKey
overridesonClickOutside
overrides
Preview documentation changes for this PR: https://eui.elastic.co/pr_6500/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM! I tested locally for keyboard navigation with Esc
key, and on VoiceOver with Safari and Firefox. I explored the keyboard navigation UX vs. mouse click UX with the screen reader turned on.
@cee-chen and I agree pressing ESC
to close a modal is well-established for keyboard and screen reader users, so we opted not to allow that to be overridden. The cost of breaking that contract felt too high.
Allowing for a confirmation modal on outside click feels like a good way to avoid unsaved work while maintaining the UX contract for keyboard navigation.
## Summary `eui@72.0.0` ⏩ `eui@72.1.0` --- ## [`72.1.0`](https://github.com/elastic/eui/tree/v72.1.0) - Changed design of empty ranges in `EuiColorStops` to have diagonal gray stripes instead of a solid light gray color ([#6489](elastic/eui#6489)) - Changed popover in `EuiColorStops` to not appear when dragging/moving a color stop ([#6489](elastic/eui#6489)) - `EuiPopover` now supports overriding `focusTrapProps.onClickOutside`, which allows customization of auto-close behavior on outside click. ([#6500](elastic/eui#6500)) **CSS-in-JS conversions** - Converted `EuiColorStops` to Emotion ([#6489](elastic/eui#6489)) - Added `brighten` service to manipulate CSS-in-JS colors ([#6489](elastic/eui#6489))
Summary
closes #6498
It appears the Lens team wants the ability to add a confirmation modal on EuiPopover outside click, in order for consumers to not lose progress or input if they accidentally click away/outside of the popover before finishing their action within the popover.
This is currently not supported by EuiPopover via
closePopover
(and cannot be). Instead, we need to modifyfocusTrapProps
to support overriding our internal popoveronOutsideClick
method, which then will allow a consumer to toggle a confirmation modal manually:QA
General checklist
or updated **jest andcypress tests**- [ ] Checked in both light and dark modes- [ ] Checked Code Sandbox works for any docs examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Updated the Figma library counterpart