desk: a segment's rounded ends are the first and last segment
:first-child missed the first segment when a fieldset's legend came before it. Select by :nth-child(1 of [estilo-seg-item]) and its last-child counterpart instead.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2 files changed,
+21
−2
desk/desk.css+2 −2desk/desk_test.go+19 −0
CI passed — run details
Intent
diff --git a/desk/desk.css b/desk/desk.css| index 4d97dd1..43d31f9 100644 |
| --- a/desk/desk.css |
| +++ b/desk/desk.css |
| @@ -121,11 +121,11 @@ |
| line-height: 1; |
| cursor: pointer; |
| } |
| -[estilo-seg-item]:first-child { |
| +[estilo-seg-item]:nth-child(1 of [estilo-seg-item]) { |
| border-start-start-radius: 8px; |
| border-end-start-radius: 8px; |
| } |
| -[estilo-seg-item]:last-child { |
| +[estilo-seg-item]:nth-last-child(1 of [estilo-seg-item]) { |
| border-start-end-radius: 8px; |
| border-end-end-radius: 8px; |
| } |
diff --git a/desk/desk_test.go b/desk/desk_test.go| index 00139ee..4499051 100644 |
| --- a/desk/desk_test.go |
| +++ b/desk/desk_test.go |
| @@ -68,3 +68,22 @@ func TestForcedColoursSelectionAndFocusAreSeparate(t *testing.T) { |
| t.Error("forced colours: an inset outline would hide focus on a selected segment") |
| } |
| } |
| + |
| +// The ends of a segmented control are its first and last segment, not its |
| +// first and last child: a <fieldset>'s <legend> is its first child. |
| +func TestSegEndsAreTheFirstAndLastSegment(t *testing.T) { |
| + src := string(CSS()) |
| + for _, want := range []string{ |
| + ":nth-child(1 of [estilo-seg-item])", |
| + ":nth-last-child(1 of [estilo-seg-item])", |
| + } { |
| + if !strings.Contains(src, want) { |
| + t.Errorf("desk.css lost %q", want) |
| + } |
| + } |
| + for _, bad := range []string{"[estilo-seg-item]:first-child", "[estilo-seg-item]:last-child"} { |
| + if strings.Contains(src, bad) { |
| + t.Errorf("desk.css still uses %q", bad) |
| + } |
| + } |
| +} |