Add alt-d shortcut to select address bar text (#37794)

I usually use the alt-d in shortcut in Firefox to select the text in the
address bar. Firefox supports both alt-d and ctrl-l. This change adds
the alt-d shortcut so you can use either.

Testing: I tested it by running Servo and pressing alt-d. I don't know
if there is a way to create a test for it?

---------

Signed-off-by: Michael Mc Donnell <michael@mcdonnell.dk>
This commit is contained in:
Michael Mc Donnell 2025-07-02 00:31:55 -04:00 committed by GitHub
parent a13f9bce62
commit b8ac9d3472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -331,8 +331,14 @@ impl Minibrowser {
if location_field.changed() {
location_dirty.set(true);
}
// Handle adddress bar shortcut.
if ui.input(|i| {
i.clone().consume_key(Modifiers::COMMAND, Key::L)
if cfg!(target_os = "macos") {
i.clone().consume_key(Modifiers::COMMAND, Key::L)
} else {
i.clone().consume_key(Modifiers::COMMAND, Key::L) ||
i.clone().consume_key(Modifiers::ALT, Key::D)
}
}) {
location_field.request_focus();
if let Some(mut state) =