Skip to content

Commit

Permalink
fix: Node::is_focusable always returns true if the node is focused (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcampbell authored Sep 14, 2024
1 parent 7143b2b commit d286883
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion consumer/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ impl<'a> Node<'a> {
self.tree_state.focus_id() == Some(self.id())
}

pub fn is_focused_in_tree(&self) -> bool {
self.tree_state.focus == self.id()
}

pub fn is_focusable(&self) -> bool {
self.supports_action(Action::Focus)
self.supports_action(Action::Focus) || self.is_focused_in_tree()
}

pub fn is_root(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion consumer/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::node::{Node, NodeState, ParentAndIndex};
pub struct State {
pub(crate) nodes: ChunkMap<NodeId, NodeState>,
pub(crate) data: TreeData,
focus: NodeId,
pub(crate) focus: NodeId,
is_host_focused: bool,
}

Expand Down

0 comments on commit d286883

Please sign in to comment.