MCPcopy Create free account
hub / github.com/AccessKit/accesskit / is_focused

Method is_focused

consumer/src/node.rs:75–91  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

73 }
74
75 pub fn is_focused(&self) -> bool {
76 let dominated_by_active_descendant = |node_id| {
77 self.tree_state
78 .node_by_id(node_id)
79 .and_then(|node| node.active_descendant())
80 .is_some()
81 };
82 match self.tree_state.focus_id() {
83 Some(focus_id) if focus_id == self.id() => !dominated_by_active_descendant(focus_id),
84 Some(focus_id) => self
85 .tree_state
86 .node_by_id(focus_id)
87 .and_then(|focused| focused.active_descendant())
88 .is_some_and(|active_descendant| active_descendant.id() == self.id()),
89 None => false,
90 }
91 }
92
93 pub fn is_focused_in_tree(&self) -> bool {
94 self.tree_state.focus == self.id()

Callers 2

common_filter_baseFunction · 0.45
node_updatedMethod · 0.45

Calls 4

node_by_idMethod · 0.80
active_descendantMethod · 0.80
focus_idMethod · 0.80
idMethod · 0.45

Tested by

no test coverage detected