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
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

- Added `magnifyWithExclamation` icon ([#5455](https://github.com/elastic/eui/pull/5455))

**Bug fixes**

- Fixed `EUiDataGrid`'s cell popover overlapping with modals and flyouts ([#5461](https://github.com/elastic/eui/pull/5461))

## [`43.0.0`](https://github.com/elastic/eui/tree/v43.0.0)

- Updated the organization of `EuiDataGrid`'s toolbar/grid controls ([#5334](https://github.com/elastic/eui/pull/5334))
Expand Down
1 change: 1 addition & 0 deletions src/components/datagrid/_data_grid_data_row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
// sass-lint:disable-block no-important
max-width: 400px !important;
max-height: 400px !important;
z-index: $euiZDataGridCellPopover !important;
}

.euiDataGridRowCell__expand {
Expand Down
1 change: 1 addition & 0 deletions src/components/datagrid/_variables.scss
Original file line number Diff line number Diff line change
@@ -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


$euiDataGridColumnResizerWidth: 3px; // Odd number because it straddles a border
$euiDataGridPopoverMaxHeight: $euiSize * 25;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ describe('EuiDataGridCellPopover', () => {
panelClassName="euiDataGridRowCell__popover"
panelPaddingSize="s"
panelRef={[Function]}
zIndex={8001}
>
<popoverContent
cellContentsElement={<div />}
Expand Down Expand Up @@ -91,7 +90,6 @@ describe('EuiDataGridCellPopover', () => {
panelClassName="euiDataGridRowCell__popover"
panelPaddingSize="s"
panelRef={[Function]}
zIndex={8001}
>
<popoverContent
cellContentsElement={<div />}
Expand Down
1 change: 0 additions & 1 deletion src/components/datagrid/body/data_grid_cell_popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 🤷‍♂️

display="block"
closePopover={closePopover}
onKeyDown={(event) => {
Expand Down