-
Notifications
You must be signed in to change notification settings - Fork 841
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] Initial isOpen works with outside click #4461
Conversation
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4461/ |
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4461/ |
Test failures are due to axe. The open popover prevents axe from traversing the page correctly. Will be resolved when I revert the 'revert me' docs commit. |
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.
...x-state...
LGTM! Tested the modified example, could not get into a broken state. This is awesome, and this bug also affected the datagrid expansion popover - would you mind removing usages of renderPopoverOpen
from data_grid_cell.tsx as well?
💯
Sure thing |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4461/ |
Summary
Fixes #4460, in which initializing EuiPopover with
isOpen=true
would never setstate.isOpenStable=true
and therefore disable EuiOutsideClickDetector.Previously,
componentDidUpdate
was the only place thatstate.isOpenStable
was set totrue
. This moves the open popover logic outside ofcomponentDidUpdate
to a standalone function (onOpenPopover
), which can now be called duringcomponentDidMount
.The simpler way would just be set
state.isOpenStable
duringcomponentDidMount
, but that would bypass all timing functions. I could be persuaded that this simpler path is better, though.Also, setting
isOpening: true
is no longer necessary incomponentDidMount
, but the Jest environment misses the update and causes tests and snapshots to break.Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Added or updated jest tests- [ ] Checked for accessibility including keyboard-only and screenreader modes