-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block editor: move block focus listener to block props hook #27463
Conversation
Size Change: +11 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
8dd62f6
to
d81417d
Compare
cb955bb
to
e3bbf1b
Compare
const clientId = getBlockClientId( event.target ); | ||
|
||
if ( clientId && clientId !== selectedBlockClientId ) { | ||
selectBlock( clientId ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously a client ID from a reusable block list would be set to the main store, which is a bug. The reusable block should handle this behaviour by clearing the selected block in the main store.
This breaks the Legacy Widget block. You can no longer select it in the widgets editor and e.g. see the block toolbar appear. |
Will look into it today. |
Description
This essential logic belongs in the block itself rather than on the root container. In the block we have access to the client ID without having to query the DOM.
Eventually, it would be good to get rid of the root container.
How has this been tested?
Screenshots
Types of changes
Checklist: