Repository navigation
Let a file tree's rows keep a glide running under their arrow keys - #7054
Merged
Merged
Conversation
…der their arrow keys `scrollsFor` read a `<button role="treeitem">` as a plain button, which leaves its arrow keys to the browser to scroll for. So an ArrowDown in the file tree during a glide made the keyboard controller land the glide (`landForKey`), though the tree takes the key itself and the browser never scrolls. The page jumped the rest of the glide under the focused row. The suite's shift watch reported it on a fast machine, which sends the key before the glide lands. An element's explicit role overrides its tag's, so `PLAIN_PRESSES`, `LINKS` and `RADIOS` now match a native tag only where it carries no role. A key a composite widget's row takes leaves the glide running, as it would have if typed after the glide landed. Closes #7045
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.
Pressing ArrowDown in the file tree while the page was still gliding to a file made the rest of the glide jump under the focused row. The cause is in
scrollsFor(scrolling.js). It matched the tree's<button role="treeitem">rows against the selectorbuttoninPLAIN_PRESSES, which says the browser scrolls for an arrow key pressed on that control. So the keyboard controller's capture listener landed the glide first (landForKey, from #6009), but the tree takes the arrow itself and the browser never scrolls. #7045's shift watch error was this scroll: on a fast machine the key arrives before the glide lands, while on CI runners it arrives after.An element's explicit
roleoverrides its tag's, soPLAIN_PRESSES,LINKSandRADIOSincontrol-selectors.jsnow count a native tag only where it has norole. A row in a tree, or an<a href role="tab">in a tab list, now falls under "every other control takes those keys itself".scrollsForis the only reader of those three selectors. This keeps #6009's rule as written: a key the browser scrolls for lands the glide, and a key a widget takes acts as it would once the glide had landed, which here means the glide goes on.Verification:
test_file_tree_lands_at_the_file_start_after_reading_downpressed ArrowDown once the glide tothird.mdhad started. Before the fix, the[document]case failed with the issue's error 2 times out of 2 on the Linux runner ("a scroll during the keydown ArrowDown on button … moved it by (0, 31)px"). With the fix it passed 3 times out of 3, the key arriving mid-glide with the glide carrying on.tests/runtime/scrolling.test.mjschecks that ArrowDown and PageDown on a<button role="treeitem">, and ArrowRight on an<a href role="tab">, aren't read as browser scrolls. It fails onmainand passes with the fix.pnpm run test:runtime(1116 pass) and pre-commit pass.The selectors behind
CONTROLSandPRESSESalso matchbuttonby tag whatever its role. Nothing here showed one of their readers misreading a role-overridden button, so they are unchanged.Closes #7045 — automated triage