-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List View: allow expanding and collapsing of nested blocks (#32117)
Co-authored-by: jasmussen <joen@automattic.com> Co-authored-by: James Koster <james@jameskoster.co.uk>
- Loading branch information
1 parent
cb0cec7
commit dbba260
Showing
12 changed files
with
227 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/block-editor/src/components/block-navigation/expander.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { chevronRightSmall, Icon } from '@wordpress/icons'; | ||
export default function BlockNavigationExpander( { onClick } ) { | ||
return ( | ||
// Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js | ||
// | ||
// The expander component is implemented as a pseudo element in the w3 example | ||
// https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html | ||
// | ||
// We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree. | ||
// For the current tree grid implementation, please do not try to make this a button. | ||
// | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions | ||
<span | ||
className="block-editor-block-navigation__expander" | ||
onClick={ ( event ) => onClick( event, { forceToggle: true } ) } | ||
aria-hidden="true" | ||
> | ||
<Icon icon={ chevronRightSmall } /> | ||
</span> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.