Skip to content

Commit

Permalink
Hotfix for moving focus to block library from sidebar (#66256)
Browse files Browse the repository at this point in the history
Co-authored-by: jeryj <[email protected]>
Co-authored-by: kevin940726 <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: ajlende <[email protected]>
  • Loading branch information
6 people authored Oct 22, 2024
1 parent 2453690 commit 0cab30f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ function ZoomOutModeInserters() {
>
<ZoomOutModeInserterButton
onClick={ () => {
// Hotfix for wp/6.7 where focus is not transferred to the sidebar if the
// block library is already open.
const blockLibrary = document.querySelector(
'[aria-label="Block Library"]'
);

setInserterIsOpened( {
rootClientId: sectionRootClientId,
insertionIndex: index + 1,
Expand All @@ -79,6 +85,12 @@ function ZoomOutModeInserters() {
showInsertionPoint( sectionRootClientId, index + 1, {
operation: 'insert',
} );

// If the block library was available before we opened it with `setInserterIsOpened`, we need to
// send focus to the block library.
if ( blockLibrary ) {
blockLibrary.focus();
}
} }
/>
</BlockPopoverInbetween>
Expand Down

1 comment on commit 0cab30f

@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 0cab30f.
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/11456338165
📝 Reported issues:

Please sign in to comment.