Skip to content

Focus: optional rounded focus ring (FocusRingRadius/Width) - #218

Merged
tannevaled merged 1 commit into
mainfrom
feat/focus-ring-radius
Aug 16, 2026
Merged

Focus: optional rounded focus ring (FocusRingRadius/Width)#218
tannevaled merged 1 commit into
mainfrom
feat/focus-ring-radius

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

The shared focusState.drawFocusRing was always a 1px square inset stroke, so a widget whose body is a rounded field (a pill-shaped search box) had to hand-draw its own rounded ring on top of the widget.

Change

focusState gains FocusRingRadius (> 0 → a rounded ring of that corner radius, in device units) and FocusRingWidth (stroke thickness; < 1 treated as 1). The zero value keeps the classic square ring, byte-identical for every widget that does not set it. Because focusState is embedded, the options are promoted onto every focusable widget (SearchEntry, Entry, ComboBox, …).

Why

Lets a host stop hand-drawing a rounded accent ring around a pill search box and let the SearchEntry widget draw it — the last scene-level shape in a fully widget-composed UI.

Tests / gates

  • TestDrawFocusRingRounded: unfocused paints nothing; the rounded branch (radius set, width defaulted from < 1) and the square branch both paint the accent.
  • 100% coverage; gofmt + go vet clean.

🤖 Generated with Claude Code

The shared focus ring was always a 1px square inset stroke, so a widget whose
body is a rounded field (a pill-shaped search box) had to hand-draw its own
rounded ring on top. focusState gains FocusRingRadius (>0 -> a rounded ring of
that corner radius) and FocusRingWidth (stroke thickness, <1 treated as 1); the
zero value keeps the classic square ring, byte-identical for every widget that
does not set it. Every widget that embeds focusState (SearchEntry, Entry, …) now
exposes the option via the promoted fields.

100% statement coverage; gofmt + vet clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 1ddb6ae into main Aug 16, 2026
1 check passed
@tannevaled
tannevaled deleted the feat/focus-ring-radius branch August 16, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant