Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix focus from zoom inserter #66256

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading