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
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
<BlockTitle
clientId={ parentClientId }
maximumLength={ 35 }
context="breadcrumb"
/>
</Button>
<Icon
Expand All @@ -114,7 +115,11 @@ function BlockBreadcrumb( { rootLabelText } ) {
className="block-editor-block-breadcrumb__current"
aria-current="true"
>
<BlockTitle clientId={ clientId } maximumLength={ 35 } />
<BlockTitle
clientId={ clientId }
maximumLength={ 35 }
context="breadcrumb"
/>
</li>
) }
</ul>
Expand Down
7 changes: 5 additions & 2 deletions packages/block-editor/src/hooks/block-renaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ export function addLabelCallback( settings ) {
settings.__experimentalLabel = ( attributes, { context } ) => {
const { metadata } = attributes;

// In the list view, use the block's name attribute as the label.
if ( context === 'list-view' && metadata?.name ) {
// In the list view and breadcrumb, use the block's name attribute as the label.
if (
( context === 'list-view' || context === 'breadcrumb' ) &&
metadata?.name
) {
return metadata.name;
}
};
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export const settings = {
return customName || summary;
}

if ( context === 'breadcrumb' && customName ) {
return customName;
}

if ( context === 'accessibility' ) {
return ! hasSummary
? __( 'Details. Empty.' )
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const settings = {
return customName || content;
}

if ( context === 'breadcrumb' && customName ) {
return customName;
}

if ( context === 'accessibility' ) {
return ! hasContent
? sprintf(
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const settings = {
__experimentalLabel( attributes, { context } ) {
const customName = attributes?.metadata?.name;

if ( context === 'list-view' && customName ) {
if (
( context === 'list-view' || context === 'breadcrumb' ) &&
customName
) {
return customName;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/more/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const settings = {
__experimentalLabel( attributes, { context } ) {
const customName = attributes?.metadata?.name;

if ( context === 'list-view' && customName ) {
if (
( context === 'list-view' || context === 'breadcrumb' ) &&
customName
) {
return customName;
}

Expand Down
9 changes: 6 additions & 3 deletions packages/block-library/src/navigation-submenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ export const settings = {

const customName = attributes?.metadata?.name;

// In the list view, use the block's menu label as the label.
// In the list view and breadcrumb, use the block's menu label as the label.
// If the menu label is empty, fall back to the default label.
if ( context === 'list-view' && ( customName || label ) ) {
return attributes?.metadata?.name || label;
if (
( context === 'list-view' || context === 'breadcrumb' ) &&
customName
) {
return customName;
}

return label;
Expand Down
5 changes: 4 additions & 1 deletion packages/block-library/src/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export const settings = {
__experimentalLabel( attributes, { context } ) {
const customName = attributes?.metadata?.name;

if ( context === 'list-view' && customName ) {
if (
( context === 'list-view' || context === 'breadcrumb' ) &&
customName
) {
return customName;
}

Expand Down
Loading