Skip to content

Commit d286883

Browse files
authored
fix: Node::is_focusable always returns true if the node is focused (#451)
1 parent 7143b2b commit d286883

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

consumer/src/node.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ impl<'a> Node<'a> {
4747
self.tree_state.focus_id() == Some(self.id())
4848
}
4949

50+
pub fn is_focused_in_tree(&self) -> bool {
51+
self.tree_state.focus == self.id()
52+
}
53+
5054
pub fn is_focusable(&self) -> bool {
51-
self.supports_action(Action::Focus)
55+
self.supports_action(Action::Focus) || self.is_focused_in_tree()
5256
}
5357

5458
pub fn is_root(&self) -> bool {

consumer/src/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::node::{Node, NodeState, ParentAndIndex};
1616
pub struct State {
1717
pub(crate) nodes: ChunkMap<NodeId, NodeState>,
1818
pub(crate) data: TreeData,
19-
focus: NodeId,
19+
pub(crate) focus: NodeId,
2020
is_host_focused: bool,
2121
}
2222

0 commit comments

Comments
 (0)