Keyboard navigation

Is there currently a way to navigate the GUI with the keyboard? For example, changing the focus with TAB or triggering an action with an F key (F1-F12). In the roadmap there is an open point ‘Keyboard navigation’. Does this mean that there is currently no way to control a iced-rs GUI with the keyboard?

There is the focus_next operation, which I think you need to invoke manually to navigate between inputs. You can react to key events using the listen with subscription.

1 Like

Many thanks for the help. I tried it out and it was exactly what I needed.

1 Like

For future reference you can also focus a specific widget by their widget::Id with

use iced::advanced::widget;

pub fn focus<T>(id: widget::Id) -> Task<T>
where
    T: Send + 'static,
{
    widget::operate(widget::operation::focusable::focus::<T>(id))
}

It’s the same logic as how focus_next and focus_previous are built, but the reexports make it slightly harder to discover the right incantation