-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
After converting a block to another block, the focus is lost, and keyboard shortcuts no longer work. We already have an e2e test for it:
I think I found the bug. I think this is an actual bug but could only happen when the interaction is slow enough. E2E test runs too fast so often it just won't error.
The issue is that after clicking "Convert to blocks", the button along with the block is destroyed, and the focus is lost. From that point on, pressing
Cmd+Z
does no effect and will only trigger the browser's default behavior (at least in Chrome). It can be easily reproduced when doing the test steps manually.You can also reproduce it reliably locally after adding
await page.waitForTimeout(3000);
on Line 94 below:gutenberg/packages/e2e-tests/specs/editor/blocks/classic.test.js
Lines 90 to 96 in 9ac117b
// Convert to blocks and verify it worked correctly. await clickBlockToolbarButton( 'Convert to blocks', 'content' ); await page.waitForSelector( '.wp-block[data-type="core/gallery"]' ); expect( await getEditedPostContent() ).toMatch( /<!-- wp:gallery/ ); // Check that you can undo back to a Classic block gallery in one step. await pressKeyWithModifier( 'primary', 'z' ); The reason it sometimes passes is probably because the image is still loading/uploading, but I have no idea why 😅.
Originally posted by @kevin940726 in #36123 (comment)