Page jumps away when trying to edit an anchor link
Description
Anchor links remain active in the Gutenberg editor, which makes them very hard to edit.
When you click an anchor link intending to change its URL, you will lose your position on the page.
Allowing anchors to jump appears to be deliberate but is very confusing and not great when trying to edit.
Step-by-step reproduction instructions
-
In the Gutenberg editor, add several paragraphs of text, enough to fill up at least the height of the screen. Select some text near the bottom, click the link button, and enter a URL of #.
-
Later, click on the text, expecting to see the usual popup where you can edit the link.
-
Note that while the popup is triggered, you won't see it at all; instead you have been scrolled to the very top of the page, and have to scroll all of the way back down to find the link that you were trying to edit.
Screenshots, screen recording, code snippet
No response
Environment info
Tested on a fresh installation of WordPress 6.8.3 and default themes, no Gutenberg plugin
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
- [ ] Classic
- [ ] Hybrid (e.g. classic with theme.json)
- [ ] Not sure
Hi! I tried adding an anchor link at the bottom of a long post, clicked on it, and it opens the popover without scrolling. Maybe I'm missing something? In that case, could you add more specific steps to reproduce the problem, or a video? And what browser do you use?
Video attached of following the steps above exactly; recorded in Firefox with the twentytwentyone theme in a fresh installation of WordPress.
https://github.com/user-attachments/assets/d18b4422-c8e3-440b-a7d9-e556bdc1b14a