From 5b83ac1f24a264620a2fab7d35fdc1fc933868bd Mon Sep 17 00:00:00 2001 From: Jackie6 <541172791@qq.com> Date: Thu, 14 Mar 2019 04:09:38 +0000 Subject: [PATCH 1/3] Remove id, infoid, label and aria-describedby from MenuItem --- .../components/block-settings-menu/block-convert-button.js | 1 - .../components/block-settings-menu/block-mode-toggle.js | 1 - packages/components/src/menu-item/index.js | 7 ------- .../src/components/header/feature-toggle/index.js | 1 - .../src/components/visual-editor/block-inspector-button.js | 1 - 5 files changed, 11 deletions(-) diff --git a/packages/block-editor/src/components/block-settings-menu/block-convert-button.js b/packages/block-editor/src/components/block-settings-menu/block-convert-button.js index 992292e04a5f52..17ed7170464940 100644 --- a/packages/block-editor/src/components/block-settings-menu/block-convert-button.js +++ b/packages/block-editor/src/components/block-settings-menu/block-convert-button.js @@ -15,7 +15,6 @@ export default function BlockConvertButton( { shouldRender, onClick, small } ) { className="editor-block-settings-menu__control" onClick={ onClick } icon="screenoptions" - label={ small ? label : undefined } > { ! small && label } diff --git a/packages/block-editor/src/components/block-settings-menu/block-mode-toggle.js b/packages/block-editor/src/components/block-settings-menu/block-mode-toggle.js index ffafcffff75f57..b4d881b103d2c0 100644 --- a/packages/block-editor/src/components/block-settings-menu/block-mode-toggle.js +++ b/packages/block-editor/src/components/block-settings-menu/block-mode-toggle.js @@ -26,7 +26,6 @@ export function BlockModeToggle( { blockType, mode, onToggleMode, small = false className="editor-block-settings-menu__control" onClick={ onToggleMode } icon="html" - label={ small ? label : undefined } > { ! small && label } diff --git a/packages/components/src/menu-item/index.js b/packages/components/src/menu-item/index.js index 860430b4ecb67c..1b793a2c5cf265 100644 --- a/packages/components/src/menu-item/index.js +++ b/packages/components/src/menu-item/index.js @@ -30,7 +30,6 @@ export function MenuItem( { shortcut, isSelected, role = 'menuitem', - instanceId, ...props } ) { className = classnames( 'components-menu-item__button', className, { @@ -38,16 +37,10 @@ export function MenuItem( { } ); if ( info ) { - const infoId = 'edit-post-feature-toggle__info-' + instanceId; - - // Deconstructed props is scoped to the function; mutation is fine. - props[ 'aria-describedby' ] = infoId; - children = ( { children } { info } diff --git a/packages/edit-post/src/components/header/feature-toggle/index.js b/packages/edit-post/src/components/header/feature-toggle/index.js index 4e0df7f3749b08..b855ca046c3866 100644 --- a/packages/edit-post/src/components/header/feature-toggle/index.js +++ b/packages/edit-post/src/components/header/feature-toggle/index.js @@ -26,7 +26,6 @@ function FeatureToggle( { onToggle, isActive, label, info, messageActivated, mes isSelected={ isActive } onClick={ flow( onToggle, speakMessage ) } role="menuitemcheckbox" - label={ label } info={ info } > { label } diff --git a/packages/edit-post/src/components/visual-editor/block-inspector-button.js b/packages/edit-post/src/components/visual-editor/block-inspector-button.js index 09a28d76f7eda4..e3ba1e062adfb7 100644 --- a/packages/edit-post/src/components/visual-editor/block-inspector-button.js +++ b/packages/edit-post/src/components/visual-editor/block-inspector-button.js @@ -39,7 +39,6 @@ export function BlockInspectorButton( { className="editor-block-settings-menu__control" onClick={ flow( areAdvancedSettingsOpened ? closeSidebar : openEditorSidebar, speakMessage, onClick ) } icon="admin-generic" - label={ small ? label : undefined } shortcut={ shortcuts.toggleSidebar } > { ! small && label } From df3db7f035a57f7f5e88e03fefa3c3e0d7cd174d Mon Sep 17 00:00:00 2001 From: Jackie6 <541172791@qq.com> Date: Thu, 14 Mar 2019 04:12:53 +0000 Subject: [PATCH 2/3] Update test file related to MenuItem --- .../components/src/menu-item/test/__snapshots__/index.js.snap | 2 -- packages/components/src/menu-item/test/index.js | 2 +- .../plugin-more-menu-item/test/__snapshots__/index.js.snap | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) 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 a0f00b2889f008..d029c29c0cb3aa 100644 --- a/packages/components/src/menu-item/test/__snapshots__/index.js.snap +++ b/packages/components/src/menu-item/test/__snapshots__/index.js.snap @@ -18,7 +18,6 @@ exports[`MenuItem should match snapshot when all props provided 1`] = ` exports[`MenuItem should match snapshot when info is provided 1`] = ` @@ -28,7 +27,6 @@ exports[`MenuItem should match snapshot when info is provided 1`] = ` My item Extended description of My Item diff --git a/packages/components/src/menu-item/test/index.js b/packages/components/src/menu-item/test/index.js index f521add7452c86..63ac41b337dff9 100644 --- a/packages/components/src/menu-item/test/index.js +++ b/packages/components/src/menu-item/test/index.js @@ -54,7 +54,7 @@ describe( 'MenuItem', () => { it( 'should match snapshot when info is provided', () => { const wrapper = shallow( - + My item ); 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 6e395b2e7ebae9..7fa0869a60f223 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 @@ -18,6 +18,7 @@ exports[`PluginMoreMenuItem renders menu item as button properly 1`] = ` >