GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
fix(focus): list rows and menu items are not Tab stops
A ListRow or MenuItem Button wears no plate (Button::plate declines them),
so it has no role in the walk either: a list's rows are the list's to walk,
not Tab's — cce-files' browse page would otherwise be a hundred stops.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
src/widget/input/button.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/widget/input/button.rs b/src/widget/input/button.rs
index ccee436..c765ee3 100644
--- a/src/widget/input/button.rs
+++ b/src/widget/input/button.rs
@@ -472,8 +472,13 @@ impl Paint for Button {
}
impl Input for Button {
+ /// A plate — except a ListRow or MenuItem, which wears no plate (see
+ /// [`Button::plate`]): a list's rows are walked by the list, not by Tab.
fn focus_role(&self) -> crate::widget::FocusRole {
- crate::widget::FocusRole::Plate
+ match self.kind {
+ ButtonKind::ListRow | ButtonKind::MenuItem => crate::widget::FocusRole::None,
+ _ => crate::widget::FocusRole::Plate,
+ }
}
fn on_event(&mut self, event: &Event, ectx: &mut EventCtx) -> bool {
match event {