Copy/Cut from block options menu does not work in empty Classic Block (7.0-beta1)
Description
In Safari, Copy and Cut actions from the block options dropdown menu do not work when the Classic Block is empty.
Keyboard shortcuts (Command + C / Command + X) work as expected.
The issue only occurs when the Classic Block is empty.
If the block contains content (e.g., after using "Edit" and adding text), the menu Copy/Cut actions work correctly.
This suggests a possible focus or selection issue when the Classic Block has no content.
Expected Behavior
The block should be copied or cut.
Actual Behavior
Nothing happens.
Step-by-step reproduction instructions
- Open WordPress Playground running WordPress 7.0-beta1.
- Create a new post.
- Insert a Classic Block.
- Do not add any content.
- Open the block options dropdown menu.
- Click "Copy" or "Cut".
Screenshots, screen recording, code snippet
Environment info
- WordPress: 7.0-beta1
- Environment: WordPress Playground
- OS: macOS Tahoe 26.3
- Browser: Safari 26.3
- Gutenberg plugin: Not installed
Please confirm that you have searched existing issues in the repo.
- [x] Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- [x] Yes
Please confirm which theme type you used for testing.
- [x] Block
- [x] Classic
- [x] Hybrid (e.g. classic with theme.json)
- [ ] Not sure
I can still reproduce this issue in WordPress 7.0 RC2.
For a similar block type, the “HTML Block”, copying or cutting and then pasting works as expected. However, the same operations do not work with the “Classic Block” when it is empty.
I haven’t investigated deeply, but there seems to be a structural difference between these blocks. Even when the HTML block is empty, if you check it in the Code Editor you can see that the following code is inserted: <!-- wp:html /-->. In contrast, when the Classic block is empty, no code is inserted at all. Because of this difference, the behavior of the two blocks is quite different, and I suspect this is the root cause of the bug.
Also, although the “Copy” and “Cut” options are shown in the block options menu and clicking them displays a toast message at the bottom indicating that the action completed, in reality nothing happens. Considering this discrepancy, I believe this is clearly a bug.
I was also able to reproduce this on WP 7.1-alpha-62201 and GB 23.0.0
As also shared by @hiroshisatoy, Classic block produces absolutely nothing unlike other blocks that at least have a self-closing block comment in code editor when empty.
Looking further into it, it seems like the Classic block is serialized differently from other blocks to output only raw HTML (empty content in case when nothing is added) rather than block comment delimiters.
https://github.com/WordPress/gutenberg/blob/2c88c2932fb890561e1e56bbb2486331aa1982a0/packages/blocks/src/api/serializer.tsx#L418-L423
I'll check more into how it would have been parsed if it had a comment delimiters on empty state and likely raise a fix PR if it seems appropriate.