Skip to content
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

[EuiDataGrid] Fix cell popovers overlapping with modals and flyouts #5461

Merged
merged 5 commits into from
Dec 14, 2021

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Dec 9, 2021

Summary

Before

(note that the way I get the cell popover to stick around is via the cell action alerts, which is fairly hacky and I wouldn't anticipate it happening in prod)

before

After

after

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
- [ ] Checked Code Sandbox works for any docs examples
- [ ] Added or updated jest and cypress tests
- [ ] Checked for breaking changes and labeled appropriately
- [ ] Checked for accessibility including keyboard-only and screenreader modes

  • A changelog entry exists and is marked appropriately

@@ -41,7 +41,6 @@ export function EuiDataGridCellPopover({
panelRef={panelRefFn}
panelClassName="euiDataGridRowCell__popover"
panelPaddingSize="s"
zIndex={8001}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not totally sure what the original impetus was for 8001 - if anyone has any context I'd def appreciate it!

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have any extra context here 🤷‍♂️

@@ -1,5 +1,6 @@
$euiZDataGrid: $euiZHeader - 1;
$euiZHeaderBelowDataGrid: $euiZHeader - 2;
$euiZDataGridCellPopover: $euiZHeader;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quick note of various z-index levels:

  • EuiModal mask overlays are 6000
  • EuiFlyout mask overlays are 1000, which is also what $euiZHeader is - I wanted cell popovers to still be above the base data grid, and being at the same z-index works because a flyout will load in later in the DOM than the popover and take precedence
  • EuiPopovers have a default inline z-index of 2000, hence the need for !important

Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a comment explaining the reasoning to use the $euiZHeader might be helpful in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

++ code comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Good call!

Suggested change
$euiZDataGridCellPopover: $euiZHeader;
$euiZDataGridCellPopover: $euiZHeader; // Same z-index as EuiFlyout mask overlays - cell popovers should be under both modal and flyout overlays

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5461/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5461/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

Thanks, @constancecchen. LGTM! 🎉

Tested using the following example in Chrome, Safari, Firefox, and Edge and I can confirm that the flyout is now on top of the cell popover:

Screenshot 2021-12-13 at 15 22 23

@cchaos
Copy link
Contributor

cchaos commented Dec 13, 2021

I can't seem to find the flyout example Elizabet showed above, so I'll just mention here to make sure this all works correctly in full screen mode as well.

@elizabetdev
Copy link
Contributor

elizabetdev commented Dec 13, 2021

@cchaos it's an example that I created locally to test. You can find it here: https://gist.github.com/miukimiu/cb1311bd30e9eeef522d42e5bf70cd3c.

But I tested in full-screen mode and works well! 👍🏽

The following screenshot was taken in Safari. Full-screen mode with a resized window to make the flyout overlap the cell popover:

Screenshot 2021-12-13 at 19 09 48

@cchaos
Copy link
Contributor

cchaos commented Dec 13, 2021

Thanks! 🤔 Maybe we can update one of those buttons to trigger a flyout and one to trigger a modal, so we have a consistent example to test?

@thompsongl thompsongl self-requested a review December 13, 2021 22:11
@cee-chen
Copy link
Contributor Author

I tested in fullscreen mode as well and can confirm that the cell popover works normally there. We do technically have an example that toggles flyouts and modals (the main datagrid kitchen sink example), you just need to use the alert() buttons (see my screencaps in the main PR description) to bug out the popover into sticking open.

The full solution for #5310 (allowing consumers to control popover state) should correctly fix/allow consumers to close popovers when modals or flyouts are open, and will definitely get its own example then with buttons that open flyouts/modals.

Also @thompsongl did you want to review still or am I OK to merge into main with Elizabet's approval?

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

LGTM; haven't found an example where we still get unwanted overlap

@@ -41,7 +41,6 @@ export function EuiDataGridCellPopover({
panelRef={panelRefFn}
panelClassName="euiDataGridRowCell__popover"
panelPaddingSize="s"
zIndex={8001}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have any extra context here 🤷‍♂️

@@ -1,5 +1,6 @@
$euiZDataGrid: $euiZHeader - 1;
$euiZHeaderBelowDataGrid: $euiZHeader - 2;
$euiZDataGridCellPopover: $euiZHeader;
Copy link
Contributor

Choose a reason for hiding this comment

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

++ code comment

@cee-chen cee-chen enabled auto-merge (squash) December 14, 2021 17:00
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5461/

@cee-chen cee-chen merged commit 0bea5df into elastic:main Dec 14, 2021
@cee-chen cee-chen deleted the datagrid-popover-zindex branch December 14, 2021 17:54
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.

5 participants