MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus-components / select_focused

Method select_focused

primitives/src/selectable.rs:91–110  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

89 }
90
91 pub(crate) fn select_focused(&mut self) {
92 if !self.open.cloned() {
93 return;
94 }
95 let Some(index) = self.collection.focused_index() else {
96 return;
97 };
98 if !self.collection.is_available(index) {
99 return;
100 }
101 let value = self
102 .options
103 .read()
104 .iter()
105 .find(|option| option.index == index)
106 .map(|option| option.value.clone());
107 if let Some(value) = value {
108 self.select_value(value);
109 }
110 }
111
112 fn matching_enabled_indices(&self, predicate: impl Fn(&OptionState) -> bool) -> Vec<usize> {
113 let mut indices: Vec<_> = self

Callers

nothing calls this directly

Calls 4

focused_indexMethod · 0.80
is_availableMethod · 0.80
iterMethod · 0.80
select_valueMethod · 0.80

Tested by

no test coverage detected