Skip to content

Commit

Permalink
chore: rename accessibleMenuName to ariaLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
up1512001 committed Nov 12, 2024
1 parent 3b6ae6d commit fce85c4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ A collection of blocks that allow visitors to get around your site. ([Source](ht
- **Category:** theme
- **Allowed Blocks:** core/navigation-link, core/search, core/social-links, core/page-list, core/spacer, core/home-link, core/site-title, core/site-logo, core/navigation-submenu, core/loginout, core/buttons
- **Supports:** align (full, wide), ariaLabel, inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~
- **Attributes:** __unstableLocation, accessibleMenuName, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor
- **Attributes:** __unstableLocation, ariaLabel, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor

## Custom Link

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"type": [ "string", "boolean" ],
"enum": [ "all", "insert", "contentOnly", false ]
},
"accessibleMenuName": {
"ariaLabel": {
"type": "string",
"default": ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function NavigationMenuNameControl( {
'title'
);

const { accessibleMenuName } = attributes;
const { ariaLabel } = attributes;

return (
<>
Expand All @@ -29,11 +29,11 @@ export default function NavigationMenuNameControl( {
<TextControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Accessible menu name' ) }
value={ accessibleMenuName }
onChange={ ( newAccessibleMenuName ) => {
label={ __( 'Aria label' ) }
value={ ariaLabel }
onChange={ ( newAriaLabel ) => {
setAttributes( {
accessibleMenuName: newAccessibleMenuName,
ariaLabel: newAriaLabel,
} );
} }
/>
Expand Down
16 changes: 8 additions & 8 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,17 +558,17 @@ private static function get_responsive_container_markup( $attributes, $inner_blo
* @return string Returns the navigation block markup.
*/
private static function get_nav_wrapper_attributes( $attributes, $inner_blocks ) {
$nav_menu_name = static::get_unique_navigation_name( $attributes );
$accessible_menu_name = ( ! empty( $attributes['accessibleMenuName'] ) ) ? $attributes['accessibleMenuName'] : $nav_menu_name;
$is_interactive = static::is_interactive( $attributes, $inner_blocks );
$is_responsive_menu = static::is_responsive( $attributes );
$style = static::get_styles( $attributes );
$class = static::get_classes( $attributes );
$wrapper_attributes = get_block_wrapper_attributes(
$nav_menu_name = static::get_unique_navigation_name( $attributes );
$aria_label = ( ! empty( $attributes['ariaLabel'] ) ) ? $attributes['ariaLabel'] : $nav_menu_name;
$is_interactive = static::is_interactive( $attributes, $inner_blocks );
$is_responsive_menu = static::is_responsive( $attributes );
$style = static::get_styles( $attributes );
$class = static::get_classes( $attributes );
$wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => $class,
'style' => $style,
'aria-label' => $accessible_menu_name,
'aria-label' => $aria_label,
)
);

Expand Down

0 comments on commit fce85c4

Please sign in to comment.