Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -9,6 +9,7 @@
### Internal

- Remove legacy `Notice` overrides in block placeholder notices and media replace flow error UI ([#78231](https://github.com/WordPress/gutenberg/pull/78231)).
- `ListView`: Compute the block visibility label once in `ListViewBlock` and pass it down to `ListViewBlockSelectButton`, removing a duplicated `useSelect`/`getBlockVisibilityLabel` call and clarifying that the label is exposed to assistive technology through the row's `aria-describedby`.

## 15.19.0 (2026-05-14)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import { useBlockLock } from '../block-lock';
import useListViewImages from './use-list-view-images';
import { store as blockEditorStore } from '../../store';
import { unlock } from '../../lock-unlock';
import { getBlockVisibilityLabel } from '../block-visibility';

const { Badge: WCBadge } = unlock( componentsPrivateApis );

Expand All @@ -55,6 +54,7 @@ function ListViewBlockSelectButton(
draggable,
isExpanded,
ariaDescribedBy,
visibilityLabel,
},
ref
) {
Expand All @@ -64,14 +64,10 @@ function ListViewBlockSelectButton(
context: 'list-view',
} );
const { isLocked } = useBlockLock( clientId );
const { hasPatternName, blockVisibility } = useSelect(
const hasPatternName = useSelect(
( select ) => {
const { getBlockAttributes } = unlock( select( blockEditorStore ) );
const attributes = getBlockAttributes( clientId );
return {
hasPatternName: !! attributes?.metadata?.patternName,
blockVisibility: attributes?.metadata?.blockVisibility,
};
return !! getBlockAttributes( clientId )?.metadata?.patternName;
},
[ clientId ]
);
Expand All @@ -80,9 +76,6 @@ function ListViewBlockSelectButton(
const isSticky = blockInformation?.positionType === 'sticky';
const images = useListViewImages( { clientId, isExpanded } );

// Determine visibility label from blockVisibility metadata
const visibilityLabel = getBlockVisibilityLabel( blockVisibility );

// The `href` attribute triggers the browser's native HTML drag operations.
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
Expand Down Expand Up @@ -166,9 +159,12 @@ function ListViewBlockSelectButton(
</span>
) : null }
{ !! visibilityLabel && (
// TODO: `visibilityLabel` is not exposed to
// assistive technology — the trigger is
// `aria-hidden`, so the label is sighted-hover-only.
// The tooltip below is a sighted-hover affordance for
// the (decorative) visibility icon. The same
// `visibilityLabel` is exposed to assistive technology
// via the row's `aria-describedby`, which references the
// hidden `AriaReferencedText` rendered by the parent
// `ListViewBlock`.
<Tooltip.Root>
<Tooltip.Trigger
render={
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ function ListViewBlock( {
isExpanded={ canEditBlock ? isExpanded : undefined }
selectedClientIds={ selectedClientIds }
ariaDescribedBy={ descriptionId }
visibilityLabel={ blockVisibilityDescription }
/>
<AriaReferencedText id={ descriptionId }>
{ [
Expand Down
Loading