[EuiPopover] Initial isOpen works with outside click#4461
[EuiPopover] Initial isOpen works with outside click#4461thompsongl merged 8 commits intoelastic:masterfrom
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. |
chandlerprall
left a comment
There was a problem hiding this comment.
...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=truewould never setstate.isOpenStable=trueand therefore disable EuiOutsideClickDetector.Previously,
componentDidUpdatewas the only place thatstate.isOpenStablewas set totrue. This moves the open popover logic outside ofcomponentDidUpdateto a standalone function (onOpenPopover), which can now be called duringcomponentDidMount.The simpler way would just be set
state.isOpenStableduringcomponentDidMount, but that would bypass all timing functions. I could be persuaded that this simpler path is better, though.Also, setting
isOpening: trueis 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