diff --git a/crates/ui/src/scroll/mod.rs b/crates/ui/src/scroll/mod.rs index d1d2cbac..782dd96e 100644 --- a/crates/ui/src/scroll/mod.rs +++ b/crates/ui/src/scroll/mod.rs @@ -2,19 +2,36 @@ mod scroll_view; mod scrollable; mod scrollbar; -use gpui::{AnyElement, AnyView, Div, Element, ElementId}; +use gpui::{AnyElement, AnyView, Div, Element, ElementId, Focusable, InteractiveElement, Stateful}; pub use scroll_view::*; pub use scrollable::*; pub use scrollbar::*; -pub trait Scrollable: Element + Sized { +pub trait Scrollable: Element { /// Wraps the element in a ScrollView. /// /// Current this is only have a vertical scrollbar. fn scrollable(self, id: impl Into, view: impl Into) -> ScrollView { - ScrollView::new(id.into(), view, ScrollbarAxis::Vertical).content(move |_| self) + ScrollView::new( + ElementId::Name(format!("{}:{}", id.into(), "ScrollView").into()), + view, + ScrollbarAxis::Vertical, + ) + .content(move |_| self) } } impl Scrollable for AnyElement {} impl Scrollable for Div {} +impl Scrollable for Focusable +where + E: Element, + Self: InteractiveElement, +{ +} +impl Scrollable for Stateful +where + E: Element, + Self: InteractiveElement, +{ +}