Skip to content

Commit 45dd951

Browse files
authored
Merge branch 'main' into eng-956-metadata-section
2 parents 89d2dbb + f646648 commit 45dd951

7 files changed

Lines changed: 45 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 3.22.6
4+
5+
### Patch Changes
6+
7+
- [#6002](https://github.com/saleor/saleor-dashboard/pull/6002) [`770e1b1`](https://github.com/saleor/saleor-dashboard/commit/770e1b1a5c621b00e7c8696009dfb6a8d13e6028) Thanks [@lkostrowski](https://github.com/lkostrowski)! - App <iframe>s now enable pop-ups (`"allow-popups"`) which means App can use native links to open new tab, instead using AppBridge action. In the nutshell `<a target="_blank"` is now working. It's still recommended to use `rel="noreferrer"` due to security reasons.
8+
9+
- [#6003](https://github.com/saleor/saleor-dashboard/pull/6003) [`727c049`](https://github.com/saleor/saleor-dashboard/commit/727c049ad39a91a8e1377426f1811ae21bbddefc) Thanks [@lkostrowski](https://github.com/lkostrowski)! - Fixed cmd/ctrl + click on Datagrid rows. Now they will properly open row in the new tab as expected
10+
311
## 3.22.5
412

513
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "saleor-dashboard",
3-
"version": "3.22.5",
3+
"version": "3.22.6",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/saleor/saleor-dashboard.git"

src/categories/components/CategoryListDatagrid/CategoryListDatagrid.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { TablePaginationWithContext } from "@dashboard/components/TablePagination";
1010
import { CategoryFragment } from "@dashboard/graphql";
1111
import { getPrevLocationState } from "@dashboard/hooks/useBackLinkWithState";
12+
import useNavigator from "@dashboard/hooks/useNavigator";
1213
import { PageListProps, SortPage } from "@dashboard/types";
1314
import { Item } from "@glideapps/glide-data-grid";
1415
import { Box } from "@saleor/macaw-ui-next";
@@ -39,6 +40,7 @@ export const CategoryListDatagrid = ({
3940
selectionActionButton = null,
4041
hasRowHover = true,
4142
}: CategoryListDatagridProps) => {
43+
const navigate = useNavigator();
4244
const location = useLocation();
4345
const datagridState = useDatagridChangeState();
4446
const intl = useIntl();
@@ -94,6 +96,9 @@ export const CategoryListDatagrid = ({
9496
onHeaderClicked={handleHeaderClick}
9597
rowAnchor={handleRowAnchor}
9698
menuItems={() => []}
99+
onRowClick={item => {
100+
navigate(handleRowAnchor(item));
101+
}}
97102
actionButtonPosition="right"
98103
selectionActions={() => selectionActionButton}
99104
onColumnResize={handlers.onResize}

src/components/Datagrid/Datagrid.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,17 @@ const Datagrid = ({
259259
return;
260260
}
261261

262-
if (onRowClick) {
262+
const intentToOpenInNewTab = args.metaKey || args.ctrlKey;
263+
264+
/**
265+
* Assume rowClick is standard click, if ctrl/cmd is used, let it pass to anchor logic and allow to open in a new tab
266+
*
267+
* TODO: This can be refactored, but every Datagrid is used a little different way
268+
*/
269+
if (onRowClick && !intentToOpenInNewTab) {
263270
onRowClick(item);
271+
272+
return;
264273
}
265274

266275
if (getCellAction(availableColumns, item[0])) {
@@ -270,7 +279,18 @@ const Datagrid = ({
270279
handleRowHover(args);
271280

272281
if (rowAnchorRef.current) {
273-
rowAnchorRef.current.click();
282+
/**
283+
* Dispatch click event with modifier keys preserved
284+
* This allows CMD/CTRL+click to open in new tab
285+
*/
286+
const clickEvent = new MouseEvent("click", {
287+
metaKey: args.metaKey,
288+
ctrlKey: args.ctrlKey,
289+
shiftKey: args.shiftKey,
290+
bubbles: true,
291+
});
292+
293+
rowAnchorRef.current.dispatchEvent(clickEvent);
274294
}
275295
},
276296
[rowMarkers, onRowClick, handleRowHover, rowAnchorRef],

src/extensions/views/ViewManifestExtension/components/AppFrame/AppIFrame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const _AppIFrame = forwardRef<HTMLIFrameElement, AppIFrameProps>(
4141
onLoad={onLoad}
4242
onError={onError}
4343
className={className}
44-
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads"
44+
sandbox="allow-same-origin allow-forms allow-scripts allow-downloads allow-popups"
4545
/>
4646
);
4747
},

src/orders/views/OrderDraftList/OrderDraftList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ const OrderDraftList = ({ params }: OrderDraftListProps) => {
160160
return (
161161
<PaginatorContext.Provider value={paginationValues}>
162162
<OrderDraftListPage
163+
// @ts-expect-error - due to strict-ignores, this prop is not typed properly but it is passed.
164+
onRowClick={item => {
165+
navigate(orderUrl(item));
166+
}}
163167
selectedFilterPreset={selectedPreset}
164168
filterOpts={getFilterOpts(params)}
165169
limits={limitOpts.data?.shop.limits}

src/orders/views/OrderList/OrderList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ const OrderList = ({ params }: OrderListProps) => {
138138
return (
139139
<PaginatorContext.Provider value={paginationValues}>
140140
<OrderListPage
141+
// @ts-expect-error - due to strict-ignores, this prop is not typed properly but it is passed.
142+
onRowClick={item => {
143+
navigate(orderUrl(item));
144+
}}
141145
settings={settings}
142146
currentTab={selectedPreset}
143147
disabled={!data}

0 commit comments

Comments
 (0)