-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: fix focus handler in Safari #31103
Conversation
Size Change: -12 B (0%) Total Size: 1.47 MB
ℹ️ View Unchanged
|
@@ -113,6 +113,7 @@ describe( 'List', () => { | |||
await clickBlockAppender(); | |||
await page.keyboard.press( 'Enter' ); | |||
await page.keyboard.type( '* ' ); | |||
await page.evaluate( () => new Promise( window.requestIdleCallback ) ); |
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.
@youknowriad I found the issue I think. Feel free to include in your PR. I don't mind which PR we go with. We need to wait for this:
gutenberg/packages/block-editor/src/store/controls.js
Lines 24 to 36 in 3da717b
MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: createRegistryControl( | |
( registry ) => () => { | |
const { | |
requestIdleCallback = ( callback ) => | |
setTimeout( callback, 100 ), | |
} = window; | |
requestIdleCallback( () => | |
registry | |
.dispatch( blockEditorStore ) | |
.__unstableMarkAutomaticChangeFinal() | |
); | |
} | |
), |
ae86b13
to
57953f4
Compare
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.
This looks good to me.
I think conditionally attaching event handlers for blocks though is probably something we should consider for all event handlers on blocks because of potential hidden async mode issues. That said this PR does solve the important one that we're aware of.
Thanks for the review!
Right, if the blocks is not selected, but the remaining ones are for the selected block, so that will attach instantly. |
The performance is apparently improved... 🤔 I think that's just because at a different time the tests run faster or slower.
|
Description
Handlers on a non-selected blocks could be attached with a delay, so always attach the handler.
Different from #30968 because we leave the other handlers to only attach on selected blocks. Let's see if there's any test failures in this case.
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).