mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-11 14:32:00 +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| {
|
move |position, request, is_pinned, is_selected, is_attention, is_load| {
|
||||||
tab.append(
|
tab.append(
|
||||||
position,
|
position,
|
||||||
request,
|
request.as_deref(),
|
||||||
is_pinned,
|
is_pinned,
|
||||||
is_selected,
|
is_selected,
|
||||||
is_attention,
|
is_attention,
|
||||||
@ -122,7 +122,7 @@ impl Window {
|
|||||||
action.open.on_activate({
|
action.open.on_activate({
|
||||||
let tab = tab.clone();
|
let tab = tab.clone();
|
||||||
move |_, request| {
|
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(
|
pub fn append(
|
||||||
&self,
|
&self,
|
||||||
position: Position,
|
position: Position,
|
||||||
request: Option<String>,
|
request: Option<&str>,
|
||||||
is_pinned: bool,
|
is_pinned: bool,
|
||||||
is_selected: bool,
|
is_selected: bool,
|
||||||
is_attention: 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
|
// Register dynamically created tab components in the HashMap index
|
||||||
self.index
|
self.index
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.insert(item.id.clone(), item.clone());
|
.insert(item.id.clone(), item.clone());
|
||||||
|
|
||||||
item.page.navigation.request.widget.entry.grab_focus();
|
|
||||||
|
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ impl Item {
|
|||||||
),
|
),
|
||||||
(position, request, is_pinned, is_selected, is_attention, is_load): (
|
(position, request, is_pinned, is_selected, is_attention, is_load): (
|
||||||
Position,
|
Position,
|
||||||
Option<String>,
|
Option<&str>,
|
||||||
bool,
|
bool,
|
||||||
bool,
|
bool,
|
||||||
bool,
|
bool,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user