Add complete keyboard navigation.

This commit is contained in:
2026-08-07 17:00:49 +02:00
parent 87a161058f
commit 5709c80209
38 changed files with 1943 additions and 355 deletions

View File

@@ -1,7 +1,7 @@
use std::collections::HashMap;
use iced::widget::{
Column, button, column, container, horizontal_space, mouse_area, row, scrollable, text,
Column, column, container, horizontal_space, mouse_area, row, scrollable, text,
};
use iced::{
Alignment, Background, Border, Color, Element, Length, Shadow, Subscription, Theme, Vector,
@@ -10,7 +10,7 @@ use muda::accelerator::{Accelerator, CMD_OR_CTRL, Code, Modifiers};
use muda::{Menu, MenuEvent, MenuId, MenuItem, PredefinedMenuItem, Submenu};
use crate::app::Message;
use crate::components::{inputs, popover};
use crate::components::{inputs, keyboard, popover};
use crate::state::tabs::TabType;
use bds_core::i18n::{UiLocale, translate};
@@ -640,9 +640,12 @@ fn window_menu_popup<'a>(
]
.align_y(Alignment::Center)
.spacing(16);
let mut item = button(content).padding([6, 8]).width(Length::Fill).style(
move |theme, status| menu_item_style(selected == Some(action), theme, status),
);
let mut item = keyboard::button(content)
.padding([6, 8])
.width(Length::Fill)
.style(move |theme, status| {
menu_item_style(selected == Some(action), theme, status)
});
if is_enabled {
item = item.on_press(Message::WindowMenu(WindowMenuEvent::Action(action)));
}
@@ -692,7 +695,7 @@ pub fn window_menu_view<'a>(
label
};
let trigger = mouse_area(
button(text(label).size(12))
keyboard::button(text(label).size(12))
.padding([5, 8])
.style(move |theme, status| menu_button_style(active, theme, status))
.on_press(Message::WindowMenu(WindowMenuEvent::Toggle(