From b830cbc038de5117c1c9417487ea379b850eaa39 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien <567105+nstepien@users.noreply.github.com> Date: Sat, 21 Mar 2026 21:12:50 +0000 Subject: [PATCH] `querySelector`: `:scope` -> `&` (#4011) * `querySelector`: `:scope` -> `&` * tweak failOnConsole --- src/DataGrid.tsx | 8 ++++---- test/failOnConsole.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/DataGrid.tsx b/src/DataGrid.tsx index 536fdc43e1..4826785dd5 100644 --- a/src/DataGrid.tsx +++ b/src/DataGrid.tsx @@ -411,7 +411,7 @@ export function DataGrid(props: DataGridPr ); const headerSelectionValue = useMemo((): HeaderRowSelectionContextValue => { - // no rows to select = explicitely unchecked + // no rows to select = explicitly unchecked let hasSelectedRow = false; let hasUnselectedRow = false; @@ -736,7 +736,7 @@ export function DataGrid(props: DataGridPr setDraggedOverRowIdx(overRowIdx); const ariaRowIndex = headerAndTopSummaryRowsCount + overRowIdx + 1; const el = gridEl.querySelector( - `:scope > [aria-rowindex="${ariaRowIndex}"] > [aria-colindex="${activePosition.idx + 1}"]` + `& > [aria-rowindex="${ariaRowIndex}"] > [aria-colindex="${activePosition.idx + 1}"]` ); scrollIntoView(el); } @@ -1293,11 +1293,11 @@ export function DataGrid(props: DataGridPr } function getRowToScroll(gridEl: HTMLDivElement) { - return gridEl.querySelector(':scope > [role="row"][tabindex="0"]'); + return gridEl.querySelector('& > [role="row"][tabindex="0"]'); } function getCellToScroll(gridEl: HTMLDivElement) { - return gridEl.querySelector(':scope > [role="row"] > [tabindex="0"]'); + return gridEl.querySelector('& > [role="row"] > [tabindex="0"]'); } function isSamePosition(p1: Position, p2: Position) { diff --git a/test/failOnConsole.ts b/test/failOnConsole.ts index a7b990a6fc..d04c4f8005 100644 --- a/test/failOnConsole.ts +++ b/test/failOnConsole.ts @@ -19,11 +19,11 @@ beforeAll(() => { }; }); -afterEach(({ task, signal }) => { +afterEach(() => { // Wait for the test and all `afterEach` hooks to complete to ensure all logs are caught - onTestFinished(() => { + onTestFinished(({ task, signal }) => { // avoid failing test runs twice - if (task.result!.state !== 'fail' || signal.aborted) { + if (task.result!.state !== 'fail' && !signal.aborted) { expect .soft( consoleErrorOrConsoleWarnWereCalled,