Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 src/components/datagrid/body/data_grid_cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ export class EuiDataGridCell extends Component<
},
0
);
// Close the cell popover if the popover was open and the user clicked the cell
if (this.props.popoverContext.popoverIsOpen) {
this.props.popoverContext.closeCellPopover();
}
}
};

Expand Down
17 changes: 17 additions & 0 deletions src/components/datagrid/body/data_grid_cell_popover.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,21 @@ describe('EuiDataGridCellPopover', () => {
.should('have.attr', 'data-gridcell-row-index', '1');
});
});

it('closes the cell popover when the originating cell is clicked', () => {
cy.realMount(<EuiDataGrid {...baseProps} />);
cy.get(
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();

cy.get('[data-test-subj="euiDataGridCellExpandButton"]').realClick();
cy.get('[data-test-subj="euiDataGridExpansionPopover"]').should('exist');

cy.get(
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();
cy.get('[data-test-subj="euiDataGridExpansionPopover"]').should(
'not.exist'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ describe('useCellPopover', () => {
hasArrow={false}
isOpen={true}
onKeyDown={[Function]}
onTrapDeactivation={[Function]}
panelClassName="euiDataGridRowCell__popover"
panelPaddingSize="s"
panelProps={
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 @@ -83,7 +83,6 @@ export const useCellPopover = (): {
'data-test-subj': 'euiDataGridExpansionPopover',
}}
closePopover={closeCellPopover}
onTrapDeactivation={closeCellPopover}
onKeyDown={(event) => {
if (event.key === keys.F2 || event.key === keys.ESCAPE) {
event.preventDefault();
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/5797.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed an `EuiDataGrid` bug occurring when closing cell popovers on clicking the originating cell. The original fix was unintentionally affecting cell popovers with nested modals, popovers, etc.