Restore link behaviour on datagrid rows - #6868
Merged
lkostrowski merged 5 commits intoAug 31, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: c780e84 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Each list datagrid keeps one anchor element that it moves over the cell under the cursor, so a row can be middle clicked or right clicked like an ordinary link. Glide reports cell bounds in viewport coordinates, but the anchor added the page scroll offset to them and was positioned with position: absolute inside a position: relative wrapper. It therefore landed away from the cell it pointed at, displaced by the wrapper's own position on the page, and native link gestures hit the grid canvas instead. Only Ctrl/Cmd + left click still opened a new tab, because that path dispatches a synthetic click straight at the anchor. Position the anchor with position: fixed and use the reported bounds unchanged, which puts it exactly over the hovered cell. Now that the anchor really covers the cell, pointer events reach it rather than the grid, so its visibility has to be exact: it is shown only while it covers the cell under the cursor, and hidden as soon as the pointer moves to the header, the row selection checkbox, a cell with its own action, or off the grid. Glide ignores mouse moves that land on an overlay, so an anchor left parked over a cell would swallow the pointer returning to that cell and the row would lose its hover highlight. Wheel events land on the anchor too. The previous workaround hid it on wheel, which could not work: the browser has already latched the gesture onto the anchor's scroll chain, and React registers onWheel as a passive listener, so the scroll could not be redirected. Forward the wheel delta to the grid's own scroller for the axes it can scroll, leave the rest to the page, and hide the anchor until the next hover repositions it. Fixes saleor#6345
The overlay must bind its wheel listener when the <a> mounts — lists start in a loading state, so an effect that ran once with a null ref never attached. Hide immediately (not after 100ms), on any scroll or resize, and drop href so a parked target cannot open the wrong row. Middle click stays native; cmd/ctrl-click that lands on the canvas opens the href with window.open because a synthetic click is untrusted.
mirekm
force-pushed
the
fix/6345-datagrid-row-anchor-position
branch
from
August 26, 2026 19:59
7813cf3 to
db917b0
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6868 +/- ##
==========================================
+ Coverage 57.16% 57.18% +0.02%
==========================================
Files 3564 3565 +1
Lines 74115 74153 +38
Branches 18815 18870 +55
==========================================
+ Hits 42369 42408 +39
- Misses 31066 31068 +2
+ Partials 680 677 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mirekm
approved these changes
Aug 26, 2026
lkostrowski
approved these changes
Aug 31, 2026
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.
Fixes #6345
Right clicking a product name in the catalogue no longer offers "Open link in new tab", and middle clicking navigates in the current tab instead of opening a new one. The reporter confirmed it still happens on dashboard 3.23.19. Ctrl/Cmd + left click is currently the only way to open a row in a new tab.
Cause
Each list datagrid keeps a single anchor element and moves it over the cell under the cursor, so a row can behave like an ordinary link. Glide reports cell bounds in viewport coordinates — the same bounds
TooltipContainerconsumes withposition: fixed, as its own comment notes.useRowAnchorinstead converted them to document coordinates by addingwindow.scrollX/scrollY, and applied them withposition: absolute, whose containing block is theposition: relativewrapper inPreventHistoryBack.The anchor therefore never sat on the cell it pointed at — it was displaced by the wrapper's own offset on the page. Native link gestures hit the grid canvas, which has no handling for them. Ctrl/Cmd + left click kept working only because
onCellClickeddispatches a synthetic click straight at the anchor, wherever it happens to be.Change
position: fixedand use the reported bounds unchanged, so it lands exactly over the hovered cell.onWheelas a passive listener, sopreventDefaultis ignored. Wheel deltas are forwarded to the grid's own scroller for the axes it can scroll, the page keeps the rest, and the anchor hides until the next hover repositions it.rowAnchoris only passed byreadonlylist datagrids, so this does not affect inline cell editing. Left click still resolves to a single navigation: Glide'sonMouseUpbegins withif (isOutside) return, soonRowClickdoes not also fire, and the anchor path carries the samenavigatorOpts={{ state: getPrevLocationState(location) }}those grids already pass.Verification
useRowAnchorgained regression coverage: the positioning test uses non-zero page scroll and non-zero bounds, which is what the existing test (all-zero bounds, no scroll) could not catch. It fails onmainwith320pxinstead of200px.Driven in Chromium against a real
ProductListDatagrid, with the grid deliberately offset from the document origin and the page scrolled:div<a>, withhrefAlso confirmed: vertical wheel still scrolls the page, the page does not scroll sideways into a browser back gesture, and the anchor comes back with a fresh
hrefafter a scroll.