mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-10 14:02:15 +00:00
grab focus only on request entry is empty
This commit is contained in:
parent
2b472eb618
commit
3e89b5e05e
@ -47,7 +47,7 @@ impl Window {
|
||||
move |position, request, is_pinned, is_selected, is_attention, is_load| {
|
||||
tab.append(
|
||||
position,
|
||||
request,
|
||||
request.as_deref(),
|
||||
is_pinned,
|
||||
is_selected,
|
||||
is_attention,
|
||||
@ -122,7 +122,7 @@ impl Window {
|
||||
action.open.on_activate({
|
||||
let tab = tab.clone();
|
||||
move |_, request| {
|
||||
tab.append(Position::End, Some(request), false, true, false, true);
|
||||
tab.append(Position::End, Some(&request), false, true, false, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -152,7 +152,7 @@ impl Tab {
|
||||
pub fn append(
|
||||
&self,
|
||||
position: Position,
|
||||
request: Option<String>,
|
||||
request: Option<&str>,
|
||||
is_pinned: bool,
|
||||
is_selected: bool,
|
||||
is_attention: bool,
|
||||
@ -175,13 +175,17 @@ impl Tab {
|
||||
),
|
||||
));
|
||||
|
||||
// Expect user input on tab appended has empty request entry
|
||||
// * this action initiated here because should be applied on tab appending event only
|
||||
if request.is_none() || request.is_some_and(|value| value.is_empty()) {
|
||||
item.page.navigation.request.widget.entry.grab_focus();
|
||||
}
|
||||
|
||||
// Register dynamically created tab components in the HashMap index
|
||||
self.index
|
||||
.borrow_mut()
|
||||
.insert(item.id.clone(), item.clone());
|
||||
|
||||
item.page.navigation.request.widget.entry.grab_focus();
|
||||
|
||||
item
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ impl Item {
|
||||
),
|
||||
(position, request, is_pinned, is_selected, is_attention, is_load): (
|
||||
Position,
|
||||
Option<String>,
|
||||
Option<&str>,
|
||||
bool,
|
||||
bool,
|
||||
bool,
|
||||
|
Loading…
x
Reference in New Issue
Block a user