Insert/edit link toolbar button triggers repeating scroll-to-bottom via execCommand → focus (related to #3422)
** Provide detailed reproduction steps (if any)** Please provide the steps to reproduce and if possible a minimal demo of the problem via [fiddle.tiny.cloud](https://fiddle.tiny.cloud) or similar.
- Embed a TinyMCE editor instance within a long HTML page (enough content that the editor sits well below the top of the viewport), on the front end of a WordPress site (not the standard wp-admin post editor).
- Load the page and scroll so the editor is visible.
- Click the "Insert/edit link" toolbar button once. Do not type anything or interact further.
✔️ Expected result
The "Insert/edit link" dialog opens without triggering any page scroll, or at most a single, correctly-targeted scroll that keeps the editor toolbar in view.
❌ Actual result
The page immediately and repeatedly auto-scrolls to the very bottom of the document (well past the editor itself), looping/re-triggering rather than settling, and making the page unusable until reload. This happens before the link dialog (#wp-link-wrap) is even inserted into the DOM — confirmed via DevTools that the dialog element is not present at the moment the scroll occurs.
Captured via a DevTools "scroll" Event Listener Breakpoint, the call stack at the point of the scroll event is:
d (tinymce.min.js)
scroll
rh (tinymce.min.js)
(anonymous) (tinymce.min.js)
uh (tinymce.min.js)
focus (tinymce.min.js)
execCommand (tinymce.min.js)
execCommand (tinymce.min.js)
(anonymous) (tinymce.min.js)
(anonymous) (tinymce.min.js)
fire (theme.min.js)
o (theme.min.js)
C (tinymce.min.js)
d (tinymce.min.js)This shows the toolbar button's click handler invoking execCommand, which calls .focus() on the editor, which in turn fires TinyMCE's internal scroll-into-view logic — and that logic appears to compute an incorrect/oversized scroll target.
This appears to be the same underlying mechanism reported in #3422 (execCommand triggering a scroll to the editor's position), but with a different trigger (clicking the link toolbar button specifically, rather than a programmatic execCommand call on load) and a looping rather than single-jump result. #3422 is currently closed with no apparent fix, so filing this as a new report with a more specific repro.
❓ Possible solution
Possibly suppress or correctly bound the internal scroll-into-view call fired by .focus() during execCommand, particularly for commands (like opening the link dialog) that don't require moving the user's viewport at all. Alternatively, allow disabling this scroll-into-view behavior via an editor init option for embeds where the page layout is managed outside TinyMCE's assumptions.
Other details
- Browser: Chrome ver 151.0.7922.174 and Explorer ver 152.0.4191.53
- OS: Windows 11
- First affected version: 49110-20250317 (per
tinymce.min.js?ver=49110-20250317, bundled with WordPress core) - Worked in version: Unknown — not yet tested against earlier TinyMCE builds
Source: tinymce/tinymce