Repository navigation
[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/ |
1Copenut
left a comment
There was a problem hiding this comment.
👍 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 `[email protected]` ⏩ `[email protected]` --- ## [`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 modifyfocusTrapPropsto support overriding our internal popoveronOutsideClickmethod, 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