Skip to content

fix: withdraw a file tree row's keys when focus leaves it - #7028

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-7020
Nov 24, 2026
Merged

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

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Each file tree row the user focused kept the tree's shared command declaration. That declaration's when reads whether any row in the tree holds focus. Since #6927 replaced focused() with a read of the shadow root's activeElement, Leaf rereads a scope's rows only around the node focus left and the node it reached (markAroundMove in keyboard/scopes.js). That matches the contract in module-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 their aria-keyshortcuts.

With this change, only the focused row carries the declaration. The widget's onCurrentLocation handler withdraws it from the tree row focus leaves (lfCommands = null plus lf-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 of tests/journeys/test_render_navigation.py::test_presses_and_fills_leave_no_element_naming_stale_keys fail on main and 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 two test_file_tree_* browser tests) also pass. The browser type check and pre-commit's eslint/oxfmt pass too.

Closes #7020 — automated triage

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
@leaf-agent
leaf-agent merged commit 5b58814 into main Nov 24, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7020 branch November 24, 2026 17:40
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_presses_and_fills_leave_no_element_naming_stale_keys: file tree rows repaint aria-keyshortcuts since #6927

1 participant