Skip to content

Commit 9a3c298

Browse files
committed
fix opening datagrid row in a new tab
1 parent 770e1b1 commit 9a3c298

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

.changeset/slick-words-spend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"saleor-dashboard": patch
3+
---
4+
5+
Fixed cmd/ctrl + click on Datagrid rows. Now they will properly open row in the new tab as expected

src/components/Datagrid/Datagrid.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,17 @@ const Datagrid = ({
270270
handleRowHover(args);
271271

272272
if (rowAnchorRef.current) {
273-
rowAnchorRef.current.click();
273+
/**
274+
* Dispatch click event with modifier keys preserved
275+
* This allows CMD/CTRL+click to open in new tab
276+
*/
277+
const clickEvent = new MouseEvent("click", {
278+
metaKey: args.metaKey,
279+
ctrlKey: args.ctrlKey,
280+
shiftKey: args.shiftKey,
281+
});
282+
283+
rowAnchorRef.current.dispatchEvent(clickEvent);
274284
}
275285
},
276286
[rowMarkers, onRowClick, handleRowHover, rowAnchorRef],

0 commit comments

Comments
 (0)