Skip to content

Commit

Permalink
Fix accessibility of the hooked blocks toggles. (#63133)
Browse files Browse the repository at this point in the history
Co-authored-by: afercia <[email protected]>
Co-authored-by: joedolson <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: mirka <[email protected]>
  • Loading branch information
5 people committed Sep 17, 2024
1 parent 59595f6 commit fe276a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
17 changes: 3 additions & 14 deletions packages/block-editor/src/hooks/block-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -204,14 +200,7 @@ function BlockHooksControlPure( {
__nextHasNoMarginBottom
checked={ checked }
key={ block.title }
label={
<HStack justify="flex-start">
<BlockIcon
icon={ block.icon }
/>
<span>{ block.title }</span>
</HStack>
}
label={ block.title }
onChange={ () => {
if ( ! checked ) {
// Create and insert block.
Expand Down
9 changes: 0 additions & 9 deletions packages/block-editor/src/hooks/block-hooks.scss
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down

1 comment on commit fe276a9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in fe276a9.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10904575157
📝 Reported issues:

Please sign in to comment.