SIGN IN SIGN UP

theme: Let an application turn the focus ring off (#2727)

## Description

The focus ring is painted outside the element's border, so any ancestor
that
clips its content cuts it off — the same as CSS `outline` under
`overflow: hidden`.

That is fine when a layout has room for it, and awkward when it does
not. In a
dense application the ring gets clipped by a scrolling toolbar, then by
a
collapsing panel, then by whatever region comes next; each one is found
only by
noticing a ring with a flat edge, and fixed by rebalancing that
container's
padding. Adding a control to a clipping region silently reopens the
question.

Give the theme a switch, alongside `shadow`:

```rust
Theme::global_mut(cx).focus_ring = false;
```

Off, a focused control shows its tinted border and nothing else — no
space to
reserve, nothing to clip:

```rust
fn focus_ring_style(mut self, window: &Window, cx: &App) -> Self {
    if !cx.theme().focus_ring {
        return self.border_color(cx.theme().ring);
    }
    // …ring as before
}
```

Default stays `true`, so nothing changes unless an application asks for
it.
`#[serde(default)]` keeps existing theme files loading.

Found while moving a downstream application onto #2726: it clips in
enough
places that reserving room container by container was going to be an
ongoing
tax, and the tinted border alone reads well there.

> AI-generated with Claude Code, reviewed and adjusted by hand.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
J
Jason Lee committed
e443a9d4ecb186a6bf243880affa5c24b4faf53c
Parent: b8e71a4
Committed by GitHub <noreply@github.com> on 8/15/2026, 8:11:41 AM