fix: Node::is_focusable
always returns true if the node is focused
#451
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.
I think it's reasonable to only add a given action to a node if that action does something meaningful in the node's current state. And we may want to recommend that. But things like the UIA
IsKeyboardFocusable
property and the AT-SPI focusable state should be set even when the node is already focused, so the node might not have theFocus
action in that state.One subtlety: I added a helper,
is_focused_in_tree
, to check whether the node is focused within the tree, regardless of whether the host (e.g. window) is focused. If the node is focused in the tree, then the node might not have theFocus
action, regardless of whether the host is focused.