Skip to content

Commit c1cbe15

Browse files
committed
Update viewport visibility logic to use 'key' instead of 'value' for device type across multiple components
1 parent 5070468 commit c1cbe15

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/block-editor/src/components/block-visibility/viewport-visibility-info.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { Badge } = unlock( componentsPrivateApis );
2525
const DEFAULT_VISIBILITY_STATE = {
2626
currentBlockVisibility: undefined,
2727
hasParentHiddenEverywhere: false,
28-
selectedDeviceType: BLOCK_VISIBILITY_VIEWPORTS.desktop.value,
28+
selectedDeviceType: BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
2929
};
3030

3131
export default function ViewportVisibilityInfo( { clientId } ) {
@@ -49,7 +49,7 @@ export default function ViewportVisibilityInfo( { clientId } ) {
4949
getBlockAttributes( clientId )?.metadata?.blockVisibility,
5050
selectedDeviceType:
5151
getSettings()?.[ deviceTypeKey ]?.toLowerCase() ||
52-
BLOCK_VISIBILITY_VIEWPORTS.desktop.value,
52+
BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
5353
hasParentHiddenEverywhere:
5454
isBlockParentHiddenEverywhere( clientId ),
5555
};

packages/block-editor/src/hooks/grid-visualizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function GridTools( { clientId, layout } ) {
5454
const settings = getSettings();
5555
const currentDeviceType =
5656
settings?.[ deviceTypeKey ]?.toLowerCase() ||
57-
BLOCK_VISIBILITY_VIEWPORTS.desktop.value;
57+
BLOCK_VISIBILITY_VIEWPORTS.desktop.key;
5858

5959
return {
6060
isVisible: true,

packages/block-editor/src/hooks/layout-child.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function GridTools( {
244244
blockAttributes?.metadata?.blockVisibility,
245245
deviceType:
246246
settings?.[ deviceTypeKey ]?.toLowerCase() ||
247-
BLOCK_VISIBILITY_VIEWPORTS.desktop.value,
247+
BLOCK_VISIBILITY_VIEWPORTS.desktop.key,
248248
// Check if the selected child block is itself a grid.
249249
isChildBlockAGrid: blockAttributes?.layout?.type === 'grid',
250250
};

0 commit comments

Comments
 (0)