You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Selection of several elements causing jump to the top of the Theme Editor #37893
General InterfaceParts of the UI which don't fall neatly under other labels.[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Feature] Writing FlowBlock selection, navigation, splitting, merging, deletion...[Type] BugAn existing feature does not function as intended
// For some browsers, like Safari, it is important that focus happens
// BEFORE selection.
node.focus();
Basically if we remove that line, everything seems to work properly.
The problem though is that the origin of this line is this PR #30202 (it was refactored later as hooks but that's where it comes from originally) and on my testing if I remove the line, copy/pasting multi-selection in Safari breaks, it results in a lot of extra empty lines in RichTexts.
Also if I try to guess, the issue is only visible in the site editor because the post editor is not Iframed yet and "focusing the canvas" is scrolling the page only if the browser selection actually contains something that is outside the editor canvas, for instance in my testing above, if I move the mouse over the footer (breadcrumb) of the editor.
Ideally we should find a fix that solves both issues at the same time. Potentially remove any "ranges" that are outside the "node" from the selection object before calling node.focus but not sure if that works. cc @mcsf
I think this was fixed in #80651, which made the canvas focus during multi-selection use preventScroll so the editor doesn't scroll back to the top anymore. This doesn't seem reproducible on trunk (tested with Chrome and Safari), so I'm closing this one. Feel free to reopen if I'm missing something.
General InterfaceParts of the UI which don't fall neatly under other labels.[Feature] Site EditorRelated to the overarching Site Editor (formerly "full site editing")[Feature] Writing FlowBlock selection, navigation, splitting, merging, deletion...[Type] BugAn existing feature does not function as intended
Activity
annezazu commentedon Jan 11, 2022
I can replicate this with 5.9 RC2 using TT2. Adding to the 5.9 for triage but not quite sure this is high priority enough to address.
carolinan commentedon Jan 12, 2022
I can reproduce this also with different themes (5.9 RC2 with Gutenberg trunk)
youknowriad commentedon Jan 17, 2022
mmm! I haven't been able to reproduce personally. Could have this been recently fixed somehow?
youknowriad commentedon Jan 17, 2022
Ok I reproduce sometimes but not consistently. I think I reproduce if I drag my mouse to the bottom of the screen but otherwise I don't.
youknowriad commentedon Jan 17, 2022
So I tried to debug this more and found that this is related to the line here
gutenberg/packages/block-editor/src/components/writing-flow/use-multi-selection.js
Lines 134 to 136 in 3715fa4
Basically if we remove that line, everything seems to work properly.
The problem though is that the origin of this line is this PR #30202 (it was refactored later as hooks but that's where it comes from originally) and on my testing if I remove the line, copy/pasting multi-selection in Safari breaks, it results in a lot of extra empty lines in RichTexts.
Also if I try to guess, the issue is only visible in the site editor because the post editor is not Iframed yet and "focusing the canvas" is scrolling the page only if the browser selection actually contains something that is outside the editor canvas, for instance in my testing above, if I move the mouse over the footer (breadcrumb) of the editor.
Ideally we should find a fix that solves both issues at the same time. Potentially remove any "ranges" that are outside the "node" from the selection object before calling
node.focusbut not sure if that works. cc @mcsfntsekouras commentedon Sep 21, 2026
I think this was fixed in #80651, which made the canvas focus during multi-selection use preventScroll so the editor doesn't scroll back to the top anymore. This doesn't seem reproducible on trunk (tested with Chrome and Safari), so I'm closing this one. Feel free to reopen if I'm missing something.