From f92944546f0aebfc3b787dbec64877bc2d563d45 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 29 Sep 2025 18:11:25 +0800 Subject: [PATCH] chore: Disable tab stop for some popover elements. (#1306) --- crates/story/src/drawer_story.rs | 1 + crates/ui/src/color_picker.rs | 7 +++++-- crates/ui/src/time/calendar.rs | 4 ++++ crates/ui/src/time/date_picker.rs | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/story/src/drawer_story.rs b/crates/story/src/drawer_story.rs index 8749b8b9..53b0bed4 100644 --- a/crates/story/src/drawer_story.rs +++ b/crates/story/src/drawer_story.rs @@ -84,6 +84,7 @@ impl ListDelegate for ListItemDeletegate { ) .suffix(|_, _| { Button::new("like") + .tab_stop(false) .icon(IconName::Heart) .with_variant(ButtonVariant::Ghost) .size(px(18.)) diff --git a/crates/ui/src/color_picker.rs b/crates/ui/src/color_picker.rs index a8439b40..a090e5d5 100644 --- a/crates/ui/src/color_picker.rs +++ b/crates/ui/src/color_picker.rs @@ -261,8 +261,11 @@ impl ColorPicker { .shadow_xs() }) .active(|this| this.border_color(color.darken(0.5)).bg(color.darken(0.2))) - .on_mouse_move(window.listener_for(&state, move |state, _, _, cx| { + .on_mouse_move(window.listener_for(&state, move |state, _, window, cx| { state.hovered_color = Some(color); + state.state.update(cx, |input, cx| { + input.set_value(color.to_hex(), window, cx); + }); cx.notify(); })) .on_click(window.listener_for( @@ -329,7 +332,7 @@ impl ColorPicker { .size_5() .rounded(cx.theme().radius), ) - .child(TextInput::new(&state.read(cx).state)), + .child(TextInput::new(&state.read(cx).state).small()), ) }) } diff --git a/crates/ui/src/time/calendar.rs b/crates/ui/src/time/calendar.rs index c1aaf202..e07de2d9 100644 --- a/crates/ui/src/time/calendar.rs +++ b/crates/ui/src/time/calendar.rs @@ -619,6 +619,7 @@ impl Calendar { .child( Button::new("prev") .icon(IconName::ArrowLeft) + .tab_stop(false) .ghost() .disabled(disabled) .with_size(icon_size) @@ -642,6 +643,7 @@ impl Calendar { .ghost() .label(state.month_name(0)) .compact() + .tab_stop(false) .with_size(self.size) .selected(view_mode.is_month()) .on_click(window.listener_for( @@ -661,6 +663,7 @@ impl Calendar { .ghost() .label(current_year.to_string()) .compact() + .tab_stop(false) .with_size(self.size) .selected(view_mode.is_year()) .on_click(window.listener_for( @@ -696,6 +699,7 @@ impl Calendar { Button::new("next") .icon(IconName::ArrowRight) .ghost() + .tab_stop(false) .disabled(disabled) .with_size(icon_size) .when(view_mode.is_day(), |this| { diff --git a/crates/ui/src/time/date_picker.rs b/crates/ui/src/time/date_picker.rs index c1b9572b..5e5bec09 100644 --- a/crates/ui/src/time/date_picker.rs +++ b/crates/ui/src/time/date_picker.rs @@ -458,6 +458,7 @@ impl RenderOnce for DatePicker { Button::new(("preset", i)) .small() .ghost() + .tab_stop(false) .label(preset.label.clone()) .on_click(window.listener_for( &self.state,