diff --git a/ports/servoshell/desktop/minibrowser.rs b/ports/servoshell/desktop/minibrowser.rs index 46957fdde05..b88c5c3b705 100644 --- a/ports/servoshell/desktop/minibrowser.rs +++ b/ports/servoshell/desktop/minibrowser.rs @@ -340,7 +340,11 @@ impl Minibrowser { i.clone().consume_key(Modifiers::ALT, Key::D) } }) { + // The focus request immediately makes gained_focus return true. location_field.request_focus(); + } + // Select address bar text when it's focused (click or shortcut). + if location_field.gained_focus() { if let Some(mut state) = TextEditState::load(ui.ctx(), location_id) { @@ -352,6 +356,7 @@ impl Minibrowser { state.store(ui.ctx(), location_id); } } + // Navigate to address when enter is pressed in the address bar. if location_field.lost_focus() && ui.input(|i| i.clone().key_pressed(Key::Enter)) {