Repository navigation
fix: restore a drag's passage when it is released over the floating panel - #6288
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 onpointermovewith the samepageWordsreading 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_passagefails 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 itscoveredreading 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-bottommakes 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.pyandtest_render_formulas.py(85 passed), pluspnpm run test:runtime(1007 passed) andpnpm run check.Closes #6286 — automated triage