pub fn focusable(theme: &Theme, handle: &FocusHandle, el: Div) -> DivExpand description
Put a stateless control into the tab order, show when it holds focus, and
let enter/space press it.
The ring is the same one crate::input::TextField paints — the border in
Theme::ring — so a focused button and a focused field read alike.
Keyboard focus only, like CSS :focus-visible. A control also takes focus
when clicked, and a ring that landed on it there would outline a slider for
the whole drag — the pointer already says which control is being used.
It lands on the control’s own border, which is why every control in
crate::widgets carries one even where it paints nothing: gpui sizes
border-box, so a border that only appeared on focus would move the content
under it by a pixel. A ring wrapped around the control instead would cost
every one of them a radius parameter, and would prise a focused tab off the
hairline its underline has to overlap.
Pressing dispatches Activate. Use pressable to route it and a click
through one callback, or handle it separately for custom interaction.