Skip to content

[EuiModal] Ensure Modal closes in correct order for nested EuiPopover - #7939

Merged
mgadewoll merged 9 commits into
elastic:mainfrom
mgadewoll:modal/7879-prevent-closing-nested-popovers
Aug 2, 2024
Merged

mgadewoll merged 9 commits into
elastic:mainfrom
mgadewoll:modal/7879-prevent-closing-nested-popovers

Conversation

@mgadewoll

@mgadewoll mgadewoll commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor

Summary

closes #7879

This PR updates EuiModal to ensure that nested EuiPopover is closed first on Escape key press, instead of the EuiModal closing completely.

Both EuiModal and EuiPopover close callbacks already have stopPropagation in place. Instead the suggested change adds a check if the event target is inside of the modal or not, ensuring that the Modal event does not take over unexpectedly.

Screen.Recording.2024-08-01.at.14.04.43.mov

QA

  • open this story and check the keyboard navigation to verify that:
    • Escape key press on the opened popover closes the popover and not the modal
    • an additional Escape key press closes the modal

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@mgadewoll
mgadewoll marked this pull request as ready for review August 1, 2024 17:06
@mgadewoll
mgadewoll requested a review from a team as a code owner August 1, 2024 17:06
Comment thread packages/eui/src/utils/type_guards.ts Resolved

@cee-chen cee-chen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎉 Fantastic job again!

@mgadewoll
mgadewoll enabled auto-merge (squash) August 2, 2024 16:09
@elasticmachine

Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@mgadewoll
mgadewoll merged commit 78eb19d into elastic:main Aug 2, 2024
@mgadewoll
mgadewoll deleted the modal/7879-prevent-closing-nested-popovers branch August 2, 2024 17:05
cee-chen added a commit to elastic/kibana that referenced this pull request Aug 5, 2024
`v95.5.0` ⏩ `v95.6.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.6.0`](https://github.com/elastic/eui/releases/v95.6.0)

- Updated `EuiIcon` with a new `crossInCircle` glyph
([#7924](elastic/eui#7924))

**Bug fixes**

- Fixed `EuiEmptyPrompt` to correctly collapse and expand responsively
when used with custom breakpoints larger than the default `xl`
breakpoint ([#7935](elastic/eui#7935))

**Accessibility**

- Improved the experience of `EuiModal` by ensuring nested `EuiPopover`
closes on `Escape` keypress instead of the modal
([#7939](elastic/eui#7939))

**CSS-in-JS conversions**

- Converted `EuiDatePicker` to Emotion
([#7937](elastic/eui#7937))
  - Removed `$euiDatePickerCalendarWidth`
  - Removed `$euiDatePickerPadding`
  - Removed `$euiDatePickerGap`
  - Removed `$euiDatePickerCalendarColumns`
  - Removed `$euiDatePickerButtonSize`
  - Removed `$euiDatePickerMinControlWidth`
  - Removed `$euiDatePickerMaxControlWidth`
  - Removed `@mixin datePickerCaret`
  - Removed `@mixin datePickerArrow`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[A11Y] Using nested EuiPopover in EuiModal: Pressing ESC in child component closes parent

3 participants