Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e8e722e
Migrate badge from WordPress components to WordPress UI Design system…
hbhalodia Sep 9, 2026
f5e3556
Remove extra css added
hbhalodia Sep 9, 2026
d758d44
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 9, 2026
72d70b3
Fix Badge component to follow Design system guidelines
hbhalodia Sep 9, 2026
e035013
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 9, 2026
39566f2
Update changelog entry
hbhalodia Sep 9, 2026
2bed3b3
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 11, 2026
ffbb783
Move changelog entry to unreleased section
hbhalodia Sep 11, 2026
c50fc11
Convert from badge to notice info
hbhalodia Sep 11, 2026
38a9a53
Update changelog entry
hbhalodia Sep 11, 2026
f31a754
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 11, 2026
a889de4
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 14, 2026
a475260
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 14, 2026
bb42bdb
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 15, 2026
bd1d726
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 17, 2026
ee3a9e1
Merge branch 'fix/issue-82440-1' of github.com:hbhalodia/gutenberg in…
hbhalodia Sep 17, 2026
362fe06
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 23, 2026
611f48e
Udpate the copy text for hidden block
hbhalodia Sep 23, 2026
c0023b9
Fix the tests
hbhalodia Sep 23, 2026
f3f4b54
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 23, 2026
ad968e5
Merge branch 'trunk' into fix/issue-82440-1
hbhalodia Sep 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- `LinkControl`, `LinkPicker`: migrate the link preview badges from the private `@wordpress/components` `Badge` to `@wordpress/ui` `Badge` ([#82684](https://github.com/WordPress/gutenberg/pull/82684)).
- `BlockQuickNavigation`: Highlight a block on the canvas while its item is hovered or focused, matching the List View. This affects the inspector Content tab, the pattern overrides panel, and the template and template part content panels ([#83049](https://github.com/WordPress/gutenberg/pull/83049)).
- Inserter and pattern search: rank title matches above keyword and description matches, and rank a word in the title that starts with the search term above a substring match ([#83312](https://github.com/WordPress/gutenberg/pull/83312)).
- `ViewportVisibilityInfo`: Migrate the block visibility badge from the private `@wordpress/components` `Badge` to `@wordpress/ui` `Notice` component ([#82670](https://github.com/WordPress/gutenberg/pull/82670)).

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,5 @@
}

.block-editor-block-visibility-info {
padding-top: $grid-unit-05;
padding-bottom: $grid-unit-05;
margin: 0 $grid-unit-20 $grid-unit-20;
display: flex;
align-items: center;
justify-content: start;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import {
Icon as WCIcon,
__experimentalText as WCText,
__experimentalHStack as HStack,
privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { __, sprintf } from '@wordpress/i18n';
import { unseen } from '@wordpress/icons';
// eslint-disable-next-line @wordpress/use-recommended-components
import { Notice } from '@wordpress/ui';
import { unlock } from '../../lock-unlock';
import { store as blockEditorStore } from '../../store';
import useBlockVisibility from './use-block-visibility';
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
import { deviceTypeKey } from '../../store/private-keys';
import { BLOCK_VISIBILITY_VIEWPORTS } from './constants';

const { Badge: WCBadge } = unlock( componentsPrivateApis );
const DEFAULT_VISIBILITY_STATE = {
currentBlockVisibility: undefined,
hasParentHiddenEverywhere: false,
Expand Down Expand Up @@ -95,39 +90,40 @@ export default function ViewportVisibilityInfo( { clientId } ) {
if ( isBlockCurrentlyHidden ) {
// Block is currently hidden - check if hidden everywhere or at specific viewport
if ( currentBlockVisibility === false ) {
label = __( 'Block is hidden' );
label = __( 'Hidden' );
} else {
const viewportLabel =
BLOCK_VISIBILITY_VIEWPORTS[ currentViewport ]?.label ||
currentViewport;
label = sprintf(
/* translators: %s: viewport name (Desktop, Tablet, Mobile) */
__( 'Block is hidden on %s' ),
__( 'Hidden on %s' ),
viewportLabel
);
}
}

// Parent is hidden - check if hidden everywhere or at specific viewport
if ( hasParentHiddenEverywhere ) {
label = __( 'Parent block is hidden' );
label = __( 'Parent hidden' );
} else if ( isBlockParentHiddenAtViewport ) {
const viewportLabel =
BLOCK_VISIBILITY_VIEWPORTS[ currentViewport ]?.label ||
currentViewport;
label = sprintf(
/* translators: %s: viewport name (Desktop, Tablet, Mobile) */
__( 'Parent block is hidden on %s' ),
__( 'Parent hidden on %s' ),
viewportLabel
);
}

return (
<WCBadge className="block-editor-block-visibility-info">
<HStack spacing={ 2 } justify="start">
<WCIcon icon={ unseen } />
<WCText>{ label }</WCText>
</HStack>
</WCBadge>
<Notice.Root
className="block-editor-block-visibility-info"
icon={ unseen }
intent="info"
>
<Notice.Description>{ label }</Notice.Description>
</Notice.Root>
);
}
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/various/block-hiding.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ test.describe( 'Block Hiding', () => {
// Open the settings sidebar.
await editor.openDocumentSettingsSidebar();

// Verify the block inspector shows "Block is hidden".
// Verify the block inspector shows "Hidden".
await expect(
page
.getByRole( 'region', { name: 'Editor settings' } )
.getByText( 'Block is hidden' )
.getByText( 'Hidden', { exact: true } )
).toBeVisible();

// Verify the Options menu now shows "Show" instead of "Hide".
Expand Down Expand Up @@ -222,11 +222,11 @@ test.describe( 'Block Hiding', () => {
// Open the settings sidebar.
await editor.openDocumentSettingsSidebar();

// Verify the block inspector shows "Block is hidden on Mobile".
// Verify the block inspector shows "Hidden on Mobile".
await expect(
page
.getByRole( 'region', { name: 'Editor settings' } )
.getByText( 'Block is hidden on Mobile' )
.getByText( 'Hidden on Mobile' )
).toBeVisible();

// Verify the Options menu now shows "Show" instead of "Hide".
Expand Down
3 changes: 0 additions & 3 deletions tools/eslint/suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,6 @@
}
},
"packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx": {
"@wordpress/use-recommended-components": {
"count": 2
},
"react/jsx-filename-extension": {
"count": 1
}
Expand Down
Loading