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
Flaky: Tiptap composer 'keeps text a mouse drag selects still' (19 vs 21) #1277
The upstream browser test ComposerPromptEditorTiptap.input.browser.test.tsx > Markdown markers around styled text > keeps text a mouse drag selects still, and shows markers for a click on release failed once on a pull request that does not touch this code (PR #1242, head eff9c34, Fork tests run 46218641453, job Test Web 3). The rerun passed.
FAIL browser (chromium) src/components/ComposerPromptEditorTiptap.input.browser.test.tsx > Markdown markers around styled text > keeps text a mouse drag selects still, and shows markers for a click on release
AssertionError: expected 21 to be 19 // Object.is equality
- Expected
+ Received
- 19
+ 21
❯ src/components/ComposerPromptEditorTiptap.input.browser.test.tsx:1297:66
1295| for (const pos of [end - 2, "start bold wo".length + 1, "start bo"…
1296| await mouse("mouseMoved", point(pos));
1297| await vi.waitFor(() => expect(editor.state.selection.head).toBe(…
The test took 1621 ms: after the first mouseMoved the selection head stayed at the press point (21) for the whole 1 s wait, so the drag never extended the selection.
Test file is upstream code (added by upstream pingdotgg#44761). Root cause and fix: to follow on this issue.
The failing wait is the first step of the drag: after one mouseMoved the head stayed at the press point (21) for the whole 1 s wait. So that one synthetic move either never extended the native selection, or something collapsed it afterwards. The test sends only one move per step, so nothing extends the selection again.
Candidates to check with an instrumented repro (CPU-throttled, repeated):
ProseMirror's focus handler: 20 ms after the first focus it calls selectionToDOM if domObserver.currentSelection differs from the DOM selection. The press is the editor's first focus (mountEditor does not focus it). If that timer runs after the move but before the selectionchange read, ProseMirror rewrites the DOM selection to its state (collapsed at 21) and Chrome does not re-extend until the next move. Its Chrome drag guard (delaySelUpdate) only skips this when currentSelection already has an anchor, and it has none before the first read.
A re-render or decoration redraw between the press and the move that replaces the text node under the native drag anchor.
If (1) is confirmed, the fix is in the test: wait for the press to be fully taken (editor focused and ProseMirror's selection read in sync with the DOM) before the first move, not a longer sleep.
The probe test is in the local clone (not pushed). It still needs a run.
Activity
scuttletoby commentedon Nov 29, 2026
Progress note (no fix yet: the local repro has not run yet, the machine had no room for it).
What is known so far:
mouseMovedthe head stayed at the press point (21) for the whole 1 s wait. So that one synthetic move either never extended the native selection, or something collapsed it afterwards. The test sends only one move per step, so nothing extends the selection again.selectionToDOMifdomObserver.currentSelectiondiffers from the DOM selection. The press is the editor's first focus (mountEditor does not focus it). If that timer runs after the move but before theselectionchangeread, ProseMirror rewrites the DOM selection to its state (collapsed at 21) and Chrome does not re-extend until the next move. Its Chrome drag guard (delaySelUpdate) only skips this whencurrentSelectionalready has an anchor, and it has none before the first read.The probe test is in the local clone (not pushed). It still needs a run.