[EuiPopover] Support custom onClickOutside overrides#6500
Merged
cee-chen merged 5 commits intoelastic:mainfrom Dec 22, 2022
Merged
[EuiPopover] Support custom onClickOutside overrides#6500cee-chen merged 5 commits intoelastic:mainfrom
onClickOutside overrides#6500cee-chen merged 5 commits intoelastic:mainfrom
Conversation
…peKey` - enabling consumers to not automatically close the popover, but instead (e.g.) trigger a confirmation that can keep the popover open
cee-chen
commented
Dec 22, 2022
|
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
approved these changes
Dec 22, 2022
Contributor
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.
1Copenut
added a commit
to elastic/kibana
that referenced
this pull request
Jan 4, 2023
## 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))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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