From 9754cab4d7abb3b966e4e066ad4157b1ac43238f Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Fri, 3 Oct 2025 14:52:53 +0800 Subject: [PATCH] button: Bind element ID after button is created (#1325) - Fix the selected-state error in the popup menu. --- crates/ui/src/button/button.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/ui/src/button/button.rs b/crates/ui/src/button/button.rs index 80beee9b..04bb6aa6 100644 --- a/crates/ui/src/button/button.rs +++ b/crates/ui/src/button/button.rs @@ -7,8 +7,8 @@ use crate::{ use gpui::{ div, prelude::FluentBuilder as _, px, relative, Action, AnyElement, App, ClickEvent, Corners, Div, Edges, ElementId, Hsla, InteractiveElement, Interactivity, IntoElement, ParentElement, - Pixels, RenderOnce, SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled, - Window, + Pixels, RenderOnce, SharedString, Stateful, StatefulInteractiveElement as _, StyleRefinement, + Styled, Window, }; #[derive(Default, Clone, Copy)] @@ -182,7 +182,7 @@ impl ButtonVariant { #[derive(IntoElement)] pub struct Button { id: ElementId, - base: Div, + base: Stateful
, style: StyleRefinement, icon: Option, label: Option, @@ -217,9 +217,13 @@ impl From