Skip to content

fix: restore a drag's passage when it is released over the floating panel - #6288

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6286
Nov 17, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6286

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Releasing a drag over the floating panel's thread quote stored everything from the press to the page's end as the passage. The guard that restores a drag's in-document range reads where the browser put the selection's far end (leftThePage). Over the layer's quote, Chrome leaves that end on the page's last words, which reads as still inside the document. So the runaway range was both remembered as "what the drag held" and kept at release. The press now records whether the hand last moved over page words (away, set on pointermove with the same pageWords reading the press begins with). The remembered range stops growing once the hand leaves, and a release with the hand away restores it. ⌘A still never reaches this path.

test_a_drag_that_overshoots_the_layer_is_not_a_passage fails on main (4384 characters stored against 684 covered) and passes with this change. #6254 did not cause the failure; its CSS moved the panel's quote 10px. Before that, the test's first leg already ended on the quote, so its covered reading was itself the 4434-character runaway, and the assertion passed without exercising the guard. With the panel's scroll padding forced to 0, the drag covers 8 characters and the release now restores exactly that passage.

The test still doesn't drag sideways: the root's scroll-padding-bottom makes Chromium autoscroll the page during the drag, so the in-document range it restores spans paragraphs 9–16. That cause is a tradeoff against the panel's landing clearance, filed as #6287.

Ran the focused selection and drag tests in test_render_anchors.py, controls/test_covering.py, test_render_aim.py, test_render_widgets.py, drafts/test_comment_targets.py, controls/test_press_away.py, test_render_reactions.py and test_render_formulas.py (85 passed), plus pnpm run test:runtime (1007 passed) and pnpm run check.

Closes #6286 — automated triage

A pointer drag that left the document was told apart by where the browser
put the selection's far end (`leftThePage`). Released over the floating
panel's thread quote, Chrome leaves that end on the page's last words,
which reads as still inside the document, so the guard kept the runaway
range from the press to the page's end as the passage. The press now also
records whether the hand last moved over page words (`away`): the range
it remembers stops growing once the hand leaves, and a release with the
hand away restores that range.

`test_a_drag_that_overshoots_the_layer_is_not_a_passage` had been passing
only because its measured in-document range was itself the runaway.
#6254 moved the panel's quote 10px and exposed that. It fails on main and
passes with this change; with the panel's autoscroll removed, the release
restores the eight characters the drag covered.

Closes #6286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_a_drag_that_overshoots_the_layer_is_not_a_passage: overshot drag keeps the selection to the page's end since #6254

1 participant