fix: use :scope instead of & in relative querySelector - #9
Merged
fastfrwrd merged 1 commit intoAug 11, 2026
Merged
Conversation
getRowToScroll/getCellToScroll build a relative selector to find the focused row/cell within the grid element. They prefix it with the CSS-nesting `&` combinator. Chromium happens to accept `&` at the start of a querySelector argument, but the standard token for "the element querySelector was called on" is `:scope`. Environments whose selector engine follows the spec strictly — for example jsdom (nwsapi), widely used in unit tests — throw `SyntaxError: '& > [role="row"]...' is not a valid selector`, breaking header and cell focus. Use `:scope`, which is equivalent in the browser and valid everywhere.
fastfrwrd
requested review from
briangann,
drew08t and
gelicia
and removed request for
a team
August 11, 2026 16:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Targets the
chore/sync-comcast-upstreambranch (#7) so the published@grafana/react-data-gridbuild carries this fix.getRowToScroll/getCellToScrollinsrc/utils/domUtils.tsprefix a relativequerySelectorwith the CSS-nesting&combinator:Chromium tolerates the leading
&, but jsdom (nwsapi) — which grafana's Table unit tests run in — throwsSyntaxError: '...' is not a valid selector, breaking header/cell focus on every header click. Without this, grafana's jest CI fails when it consumes this build (surfaced while validating the beta.59 bump in grafana-ui).Change
Use
:scopeinstead of&in both helpers. Equivalent in the browser, valid everywhere.Also submitted upstream: Comcast#4131
🤖 Generated with Claude Code