-
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
Multiple block select cut and paste failing #53774
Comments
cc @ellatrix, in case this is related to any of the recent contentEditable or other flow-related fixes. |
Seeing that error, I’m guessing the browser is cutting the blocks instead of us, and React can no longer reconcile. The lack of snackbar notification supports that. Can't reproduce though. Tried Chrome, Firefox and Safari. Which browser is this? |
Noting that keyboard shortcuts are fine but, if you right click > cut, something goes wrong. Able to replicate in Chrome. |
Ok, here's my report after debugging: This bug is fixed by #53440, but it's an accidental fix and I believe not a full fix. The bug was introduced by #51201, more specifically by 006b2a7, which actually prevents native browser behaviour on cut so we do it ourselves. That is necessary so we can set the clipboard with HTML not just on copy but on cut too (fixing a bug pre-#51201). This meant to be for non multi select only, and then it's OK. The problem is that for some reason the browser moves focus to the block's rich text wrapper (from the multi select wrapper) on click-click (opening the context menu). That's why it's triggering that rich text copy event handler instead of the global copy handler. And that's why #53440 also fixes the bug, because the browser is no longer moving focus away from the multi select handler. Somehow This is also why, btw, only one block was copied, because one of the block's rich text copy event handler was triggered instead of the global one. |
Just to add that I can reproduce in Chromium in the block editor in 6.3 by using the right-click menu to cut and paste. Doesn't happen in Firefox as it seems there multiple blocks cannot be cut from the right-click menu. The menu item is disabled. |
@azaozz Yes, it's a bug in 6.3, but fixed by #53440. I'm actually starting to think it is a good fix, because it prevents the rich text from gaining focus by removing the tab index. But it's still allowing tabindex higher than 0 through. To me this seems like an issue that should ideally be fixed at the browser level. An element with It should actually be safe for us to remove the |
Ok, here's proof that it's not entirely caused by #51201, it just aggravated the issue for cut. But pre-#53440, copying through the context menu was also broken: it will just copy only one block instead of the whole multi selection, and there would be no snackbar notification. Same bug where focus is moved because of |
Where are we in addressing this? It's unclear to me what's left to do to get this into a point release (6.3.2). |
I had commented in the #6-3-release-leads channel: https://wordpress.slack.com/archives/C051Z1SKBDZ/p1692380073185779?thread_ts=1692287531.089819&cid=C051Z1SKBDZ
|
Is this problem solved? I tested and the problem seems to be gone. |
@draganescu I explained this in my comment #53774 (comment) |
@ellatrix I don't get it 😂 I understand it's fixed, but I don't understand why this needs to remain open. |
It was an accidental fix. If it's good enough, we should probably add an e2e test so it doesn't accidentally regress in the future. |
@ellatrix can we loop back and add an e2e test to close this out? I'm going to remove the high priority label from this issue for now either way as it's no longer something we need to fix urgently and quickly per this sweep of the label. |
Description
Using both GB 16.4 and just 6.3, cut and paste fails when selecting multiple blocks by removing one of the items trying to be pasted. Tested thus far on paragraph, headings, and quote with various results.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Here's a video where I attempt to show all three scenarios with paragraph, heading (which is impacted by #48040), quote, and list:
heading.crash.mov
Here's the error:
In another attempt, it failed when pasting List items with this error:
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: