Skip to content

Commit

Permalink
Allow cell popovers to expand to larger cell widths
Browse files Browse the repository at this point in the history
- to match other screenshot Caroline posted - see the auto height datagrid demos
  • Loading branch information
cee-chen committed Nov 8, 2023
1 parent 6eb7141 commit 1ecfb1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/components/datagrid/_data_grid_data_row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@
.euiDataGridRowCell__popover {
@include euiScrollBar;
overflow: auto;
// stylelint-disable declaration-no-important
max-width: 400px !important;
max-height: 400px !important;
z-index: $euiZDataGridCellPopover !important;
// stylelint-enable declaration-no-important
// Workaround for a Safari CSS bug when using both `overflow: auto` & `filter: drop-shadow`
// (see https://github.com/elastic/eui/issues/6151)
// Disables the default EuiPopover filter drop-shadow and uses box-shadow instead,
Expand Down
7 changes: 7 additions & 0 deletions src/components/datagrid/body/data_grid_cell_popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const useCellPopover = (): {
hasArrow={false}
panelPaddingSize="s"
anchorPosition={popoverAnchorPosition}
repositionToCrossAxis={false}
{...cellPopoverProps}
focusTrapProps={{
// Include the cell actions DOM node as a shard - otherwise clicking
Expand All @@ -120,6 +121,12 @@ export const useCellPopover = (): {
cellPopoverProps.panelClassName,
cellPopoverProps.panelProps?.className
)}
panelStyle={{
maxInlineSize: `min(75vw, max(${
popoverAnchor.parentElement!.offsetWidth
}px, 400px))`,
maxBlockSize: '50vh',
}}
onKeyDown={(event) => {
if (event.key === keys.F2 || event.key === keys.ESCAPE) {
event.preventDefault();
Expand Down

0 comments on commit 1ecfb1b

Please sign in to comment.