From 2b7085a02381e01314398303375da1486f63786a Mon Sep 17 00:00:00 2001 From: Tim Wright Date: Fri, 1 Feb 2019 12:48:30 -0500 Subject: [PATCH] Fix/issue 12501 menu item aria label Removed aria-label on the menuItem component because it was redundant with the button text itself. Also update the tests and snapshots to match the new output. --- packages/components/src/menu-item/index.js | 5 ----- .../src/menu-item/test/__snapshots__/index.js.snap | 4 ---- packages/components/src/menu-item/test/index.js | 1 - .../plugin-more-menu-item/test/__snapshots__/index.js.snap | 1 - 4 files changed, 11 deletions(-) diff --git a/packages/components/src/menu-item/index.js b/packages/components/src/menu-item/index.js index fa8dd6a85d24fa..860430b4ecb67c 100644 --- a/packages/components/src/menu-item/index.js +++ b/packages/components/src/menu-item/index.js @@ -24,7 +24,6 @@ import IconButton from '../icon-button'; */ export function MenuItem( { children, - label = children, info, className, icon, @@ -38,9 +37,6 @@ export function MenuItem( { 'has-icon': icon, } ); - // Avoid using label if it is passed as non-string children. - label = isString( label ) ? label : undefined; - if ( info ) { const infoId = 'edit-post-feature-toggle__info-' + instanceId; @@ -77,7 +73,6 @@ export function MenuItem( { return createElement( tagName, { - 'aria-label': label, // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked 'aria-checked': ( role === 'menuitemcheckbox' || role === 'menuitemradio' ) ? isSelected : undefined, role, diff --git a/packages/components/src/menu-item/test/__snapshots__/index.js.snap b/packages/components/src/menu-item/test/__snapshots__/index.js.snap index 74eea47847f4ab..9ec9378f631a1e 100644 --- a/packages/components/src/menu-item/test/__snapshots__/index.js.snap +++ b/packages/components/src/menu-item/test/__snapshots__/index.js.snap @@ -3,7 +3,6 @@ exports[`MenuItem should match snapshot when all props provided 1`] = ` @@ -43,7 +41,6 @@ exports[`MenuItem should match snapshot when info is provided 1`] = ` exports[`MenuItem should match snapshot when isSelected and role are optionally provided 1`] = ` diff --git a/packages/components/src/menu-item/test/index.js b/packages/components/src/menu-item/test/index.js index f79f2da61be78e..c5508e55629ace 100644 --- a/packages/components/src/menu-item/test/index.js +++ b/packages/components/src/menu-item/test/index.js @@ -61,7 +61,6 @@ describe( 'MenuItem', () => { ); - expect( wrapper.prop( 'aria-label' ) ).not.toBeUndefined(); expect( wrapper ).toMatchSnapshot(); } ); diff --git a/packages/edit-post/src/components/header/plugin-more-menu-item/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/header/plugin-more-menu-item/test/__snapshots__/index.js.snap index 692b032d744f05..6e395b2e7ebae9 100644 --- a/packages/edit-post/src/components/header/plugin-more-menu-item/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/header/plugin-more-menu-item/test/__snapshots__/index.js.snap @@ -17,7 +17,6 @@ exports[`PluginMoreMenuItem renders menu item as button properly 1`] = ` role="menu" >