make enter key equivalent to go button when location field is focused (#30126)

This commit is contained in:
Atbrakhi 2023-08-29 11:27:53 +02:00 committed by GitHub
parent da64144ff4
commit 2afb7c1975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,6 +66,10 @@ impl Minibrowser {
if ui.input(|i| i.clone().consume_key(Modifiers::COMMAND, Key::L)) {
location_field.request_focus();
}
if location_field.lost_focus() && ui.input(|i| i.clone().key_pressed(Key::Enter)) {
event_queue.borrow_mut().push(MinibrowserEvent::Go);
location_dirty.set(false);
}
},
);
});