Repository navigation
Conversation
commit: |
cowboyd
force-pushed
the
tree-focus
branch
2 times, most recently
from
August 11, 2026 04:27
c83931f to
0376d9f
Compare
cowboyd
force-pushed
the
tree-focus
branch
3 times, most recently
from
August 22, 2026 23:46
740fa8a to
4244081
Compare
Contributor
Author
|
closing out in favor of a DOM based substrate. See #37 |
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.
Interactive terminal controls need focus, but focus is not inherently a keyboard concept and should not be reimplemented by every input element or framework adapter. A semantic Focus API provides one source of truth for the active node and lets controls declare focusability without knowing how users will navigate between them. Keeping this state in the middleware tree also makes focus available to custom element behavior such as layout, styling, and event handling.
Focus must remain valid as the Host tree changes. The first attached focusable element can become active automatically, traversal follows Host render order in both directions, and removing the focused subtree selects an appropriate replacement or returns to the host root. Focus changes also invalidate rendering so visual focus state is not delayed until another mutation.
This PR adds
FocusApi, focus installation, focusability, direct focus assignment, and wrapping depth-first forward and reverse navigation. It handles initial focus, rejects invalid targets, repairs focus during subtree removal, and requests rendering when focus changes.