Skip to content

Commit a241134

Browse files
authored
Navigation Submenu Block: Make block name affect list view (#58296)
* Navigation Submenu Block: Make block name affect list view * Fix e2e test
1 parent 11a9943 commit a241134

File tree

1 file changed

+11
-4
lines changed
  • packages/block-library/src/navigation-submenu

1 file changed

+11
-4
lines changed

packages/block-library/src/navigation-submenu/index.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,23 @@ export const settings = {
2121
if ( context === 'list-view' ) {
2222
return page;
2323
}
24-
2524
return addSubmenu;
2625
},
26+
__experimentalLabel( attributes, { context } ) {
27+
const { label } = attributes;
2728

28-
__experimentalLabel: ( { label } ) => label,
29+
const customName = attributes?.metadata?.name;
2930

30-
edit,
31+
// In the list view, use the block's menu label as the label.
32+
// If the menu label is empty, fall back to the default label.
33+
if ( context === 'list-view' && ( customName || label ) ) {
34+
return attributes?.metadata?.name || label;
35+
}
3136

37+
return label;
38+
},
39+
edit,
3240
save,
33-
3441
transforms,
3542
};
3643

0 commit comments

Comments
 (0)