Skip to content

Commit 5bd32f4

Browse files
fix(data-grid): prevent column header sorting popover from closing when cell is focused (#1114)
* fix: prevent column header sorting popover from closing when cell is focused Expand getIsInPopover to include Radix dropdown and popover content. When a cell was focused and the user clicked a column header to sort, the grid's focusout handler was stealing focus back to the cell because the dropdown content wasn't recognized as a valid popover. This caused the sorting popover to close immediately. Fixes #1108 Co-authored-by: Cursor <cursoragent@cursor.com> * chore: sync --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 119b001 commit 5bd32f4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/lib/data-grid.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,13 @@ export function scrollCellIntoView<TData>(params: {
257257
}
258258

259259
export function getIsInPopover(element: unknown): boolean {
260+
if (!(element instanceof Element)) return false;
261+
260262
return (
261-
element instanceof Element &&
262-
(element.closest("[data-grid-cell-editor]") ||
263-
element.closest("[data-grid-popover]")) !== null
263+
element.closest("[data-grid-cell-editor]") !== null ||
264+
element.closest("[data-grid-popover]") !== null ||
265+
element.closest("[data-slot='dropdown-menu-content']") !== null ||
266+
element.closest("[data-slot='popover-content']") !== null
264267
);
265268
}
266269

0 commit comments

Comments
 (0)