From fe276a946e1faf6704e678abd700c499e357aa79 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 17 Sep 2024 15:56:46 +0200 Subject: [PATCH] Fix accessibility of the hooked blocks toggles. (#63133) Co-authored-by: afercia Co-authored-by: joedolson Co-authored-by: ciampo Co-authored-by: mirka <0mirka00@git.wordpress.org> --- packages/block-editor/src/hooks/block-hooks.js | 17 +++-------------- .../block-editor/src/hooks/block-hooks.scss | 9 --------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/packages/block-editor/src/hooks/block-hooks.js b/packages/block-editor/src/hooks/block-hooks.js index b1fab1b124f8dc..04a2313b629ba7 100644 --- a/packages/block-editor/src/hooks/block-hooks.js +++ b/packages/block-editor/src/hooks/block-hooks.js @@ -3,18 +3,14 @@ */ import { __ } from '@wordpress/i18n'; import { Fragment, useMemo } from '@wordpress/element'; -import { - __experimentalHStack as HStack, - PanelBody, - ToggleControl, -} from '@wordpress/components'; +import { PanelBody, ToggleControl } from '@wordpress/components'; import { createBlock, store as blocksStore } from '@wordpress/blocks'; import { useDispatch, useSelect } from '@wordpress/data'; /** * Internal dependencies */ -import { BlockIcon, InspectorControls } from '../components'; +import { InspectorControls } from '../components'; import { store as blockEditorStore } from '../store'; const EMPTY_OBJECT = {}; @@ -204,14 +200,7 @@ function BlockHooksControlPure( { __nextHasNoMarginBottom checked={ checked } key={ block.title } - label={ - - - { block.title } - - } + label={ block.title } onChange={ () => { if ( ! checked ) { // Create and insert block. diff --git a/packages/block-editor/src/hooks/block-hooks.scss b/packages/block-editor/src/hooks/block-hooks.scss index c8f2027483ccf3..03cabd638d8684 100644 --- a/packages/block-editor/src/hooks/block-hooks.scss +++ b/packages/block-editor/src/hooks/block-hooks.scss @@ -1,13 +1,4 @@ .block-editor-hooks__block-hooks { - /** - * Since we're displaying the block icon alongside the block name, - * we need to right-align the toggle. - */ - .components-toggle-control .components-h-stack { - /* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */ - flex-direction: row-reverse; - } - /** * Un-reverse the flex direction for the toggle's label. */