Repository navigation
fix: withdraw a file tree row's keys when focus leaves it - #7028
Merged
Merged
Conversation
Each row the user focused kept the tree's shared command declaration, whose `when` reads whether any row in the tree holds focus. Since #6927, Leaf rereads a scope's rows only around the node focus left and the node it reached, so rows focused earlier kept naming the keys as they stood when focus left them, and a repaint changed their `aria-keyshortcuts`. Now only the focused row carries the declaration: the widget withdraws it from the row focus leaves. The keys reach the focused row as before. The `[file-tree]`, `[file-tree-input]` and `[deploy-config]` cases of `test_presses_and_fills_leave_no_element_naming_stale_keys` fail before this change and pass after it. Closes #7020
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.
Each file tree row the user focused kept the tree's shared command declaration. That declaration's
whenreads whether any row in the tree holds focus. Since #6927 replacedfocused()with a read of the shadow root'sactiveElement, Leaf rereads a scope's rows only around the node focus left and the node it reached (markAroundMoveinkeyboard/scopes.js). That matches the contract inmodule-input.md: rows are reread "whenever focus moves into, out of or within the scope". So rows focused earlier kept naming the keys as they stood when focus left them, and a forced repaint changed theiraria-keyshortcuts.With this change, only the focused row carries the declaration. The widget's
onCurrentLocationhandler withdraws it from the tree row focus leaves (lfCommands = nullpluslf-commands). The host's own declaration and the focused row's keys stay as they were, so Enter, Space and the arrows reach a row exactly as before. The fix stays in the package: #6927's intent, that packages ask the browser where focus is, holds without a new core mechanism.Verification: the
[file-tree],[file-tree-input]and[deploy-config]cases oftests/journeys/test_render_navigation.py::test_presses_and_fills_leave_no_element_naming_stale_keysfail onmainand pass on this branch. The file tree's pointer and keyboard tests (test_file_tree_opens_current_diff_files_by_pointer_and_keyboard,test_file_tree_lands_at_the_file_start_after_reading_down,test_a_file_tree_opens_each_file_the_editor_holds, and the twotest_file_tree_*browser tests) also pass. The browser type check and pre-commit's eslint/oxfmt pass too.Closes #7020 — automated triage