Focus: optional rounded focus ring (FocusRingRadius/Width) - #218
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The shared
focusState.drawFocusRingwas 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
focusStategainsFocusRingRadius(> 0→ a rounded ring of that corner radius, in device units) andFocusRingWidth(stroke thickness;< 1treated as1). The zero value keeps the classic square ring, byte-identical for every widget that does not set it. BecausefocusStateis 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
SearchEntrywidget 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.gofmt+go vetclean.🤖 Generated with Claude Code