Skip to content

Commit 651ccc3

Browse files
committed
fix PR 392 review: restore non-obvious WHY comments, revert badge sizes, fix indentation
- Revert badge-essential and badge-optimal sizes to pre-PR values (56.2/64.1 kB); changes were made without running npm run build so the computed values were wrong - Restore truncated .sr-only atomic contract note in accessibility.css - Add .sf-focus-shadow !important rationale and forced-colors WCAG 2.4.7 note - Restore a:link WebKit UA specificity trap comment in base.css - Add .sf-not-prose specificity exception note in macros.css - Fix 4-space → 2-space indentation for standalone class rules in macros.css and layout.css - Add .sf-cq, .sf-imposter RTL, and @container var() notes in layout.css - Add .is-disabled cursor inheritance note in states.css - Add autofill WebKit dark-mode note and chevron FieldText note in forms.css - Add LumLocker and section-theming light-dark() notes in themes.css - Add animation-duration unconditional note in motion.css Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pdaz7HQGBUBm59X7AU4Qep
1 parent 9535b88 commit 651ccc3

10 files changed

Lines changed: 50 additions & 29 deletions

File tree

core/accessibility.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
outline-offset: var(--sf-focus-ring-offset) !important;
1616
}
1717

18-
/* Focus-shadow opt-in */
18+
/* .sf-focus-shadow: replaces outline ring with box-shadow ring; !important required
19+
to take over the hardened :focus-visible outline (WCAG 2.4.7 still met). */
1920
.sf-focus-shadow:focus-visible {
2021
outline: none !important;
2122
box-shadow: var(--sf-focus-ring-shadow) !important;
2223
}
2324

25+
/* forced-colors: box-shadow vanishes — restore outline ring for WCAG 2.4.7
26+
in Windows High Contrast. */
2427
@media (forced-colors: active) {
2528
.sf-focus-shadow:focus-visible {
2629
outline: var(--sf-focus-ring-width) solid !important;
@@ -113,7 +116,8 @@
113116
opacity: var(--sf-opacity-disabled);
114117
}
115118

116-
/* Screen-reader-only. Atomic contract: a partial override */
119+
/* Screen-reader-only. Atomic contract: partial override either exposes hidden content
120+
or hides intended content — all-or-nothing, whole set hardened. */
117121
.sr-only,
118122
.sr-only-focusable:not(:focus, :focus-within) {
119123
position: absolute !important;

core/base.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
sup { top: -0.5em; }
8181
sub { bottom: -0.25em; }
8282

83+
/* :link (0,1,1) not bare a: beats WebKit UA rule a:link { color: -webkit-link }
84+
that silently overrides --sf-color-link in dark mode. */
8385
a:link {
8486
color: var(--sf-color-link);
8587
text-decoration-color: var(--sf-color-link--underline);

core/layout.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
padding-block-start: calc(var(--sf-section-pad) / 2);
2828
}
2929

30-
.sf-divider {
30+
.sf-divider {
3131
border: none;
3232
border-block-start: var(--sf-divider-width) var(--sf-divider-style) var(--sf-divider-color);
3333
margin-block: var(--sf-divider-gap);
@@ -64,7 +64,9 @@
6464
.sf-container--wide { max-width: var(--sf-container-wide); }
6565
.sf-container--full { max-width: var(--sf-container-full); }
6666

67-
.sf-cq {
67+
/* .sf-cq: CQ scope without .sf-container's max-width/centering.
68+
Use when a CQ-dependent primitive needs a container ancestor but no layout chrome. */
69+
.sf-cq {
6870
container-type: inline-size;
6971
}
7072

@@ -85,7 +87,7 @@
8587
.sf-stack--end { align-items: flex-end; }
8688
.sf-stack--stretch { align-items: stretch; }
8789

88-
.sf-gap { gap: var(--sf-gap); }
90+
.sf-gap { gap: var(--sf-gap); }
8991
.sf-gap--xs { gap: var(--sf-space-xs); }
9092
.sf-gap--s { gap: var(--sf-space-s); }
9193
.sf-gap--m { gap: var(--sf-space-m); }
@@ -201,7 +203,7 @@
201203

202204
.sf-grid--dense { grid-auto-flow: dense; }
203205

204-
.sf-icon {
206+
.sf-icon {
205207
display: inline-block;
206208
inline-size: var(--sf-icon-size, var(--sf-icon-m));
207209
block-size: var(--sf-icon-size, var(--sf-icon-m));
@@ -292,6 +294,8 @@
292294
}
293295

294296

297+
/* Physical left (not inset-inline-start): translate() uses the physical axis,
298+
so logical + translate breaks centering in RTL layouts. */
295299
.sf-imposter {
296300
position: absolute;
297301
inset-block-start: 50%;
@@ -350,6 +354,7 @@
350354
container: sf-grid / inline-size;
351355
}
352356

357+
/* Cannot use var() inside @container per CSS spec — breakpoints hardcoded. */
353358
@container (min-width: 30em) {
354359
.sf-grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
355360
.sf-grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
@@ -376,7 +381,7 @@
376381
.sf-grid-cols-3-1 { grid-template-columns: 3fr 1fr; }
377382
}
378383

379-
.sf-equal {
384+
.sf-equal {
380385
display: grid;
381386
grid-template-columns: repeat(auto-fit, minmax(min(var(--sf-equal-min-col), 100%), 1fr));
382387
gap: var(--sf-equal-gap);

core/macros.css

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
.sf-prose :is(th, td) { padding: var(--sf-prose-table-pad); }
3131
.sf-prose video { margin-block: var(--sf-prose-media-margin); border-radius: var(--sf-prose-media-radius); }
3232

33+
/* Specificity 0-2-1 intentionally beats .sf-prose's 0-2-0 child selectors —
34+
documented exception. */
3335
.sf-prose .sf-not-prose > * + * { margin-block-start: 0; }
3436
.sf-prose .sf-not-prose li + li { margin-block-start: 0; }
3537

@@ -49,11 +51,11 @@
4951
.sf-prose .sf-not-prose :is(th,td) { padding: revert; }
5052
.sf-prose .sf-not-prose video { margin-block: 0; border-radius: 0; }
5153

52-
.sf-flow > * + * {
54+
.sf-flow > * + * {
5355
margin-block-start: var(--sf-flow-space);
5456
}
5557

56-
.sf-truncate {
58+
.sf-truncate {
5759
overflow: hidden;
5860
text-overflow: ellipsis;
5961
white-space: nowrap;
@@ -77,7 +79,7 @@
7779
-webkit-line-clamp: var(--sf-line-clamp);
7880
}
7981

80-
.sf-equal-height {
82+
.sf-equal-height {
8183
display: flex;
8284
align-items: stretch;
8385
}
@@ -86,11 +88,11 @@
8688
flex: 1 1 auto;
8789
}
8890

89-
.sf-aspect {
91+
.sf-aspect {
9092
aspect-ratio: var(--sf-aspect, 16 / 9);
9193
}
9294

93-
.sf-scroll-shadow {
95+
.sf-scroll-shadow {
9496
overflow-y: auto;
9597
overflow-block: auto;
9698
/* stylelint-disable-next-line property-no-vendor-prefix -- required for Safari < 15.4 */
@@ -108,7 +110,7 @@
108110
transparent 100%);
109111
}
110112

111-
.sf-scroll-snap {
113+
.sf-scroll-snap {
112114
overflow-y: auto;
113115
overflow-block: auto;
114116
scroll-snap-type: block mandatory;
@@ -118,7 +120,7 @@
118120
scroll-snap-align: start;
119121
}
120122

121-
.sf-overflow-fade {
123+
.sf-overflow-fade {
122124
overflow: hidden;
123125
/* stylelint-disable-next-line property-no-vendor-prefix -- required for Safari < 15.4 */
124126
-webkit-mask-image: linear-gradient(
@@ -135,12 +137,12 @@
135137
);
136138
}
137139

138-
.sf-no-tap-highlight {
140+
.sf-no-tap-highlight {
139141
/* stylelint-disable-next-line property-no-vendor-prefix -- no unprefixed equivalent */
140142
-webkit-tap-highlight-color: transparent;
141143
}
142144

143-
.sf-surface { background: var(--sf-surface-color); }
145+
.sf-surface { background: var(--sf-surface-color); }
144146

145147
.sf-surface--primary { --sf-surface-color: var(--sf-color-primary); background: var(--sf-color-primary); color: var(--sf-color-text--on-primary); }
146148
.sf-surface--secondary { --sf-surface-color: var(--sf-color-secondary); background: var(--sf-color-secondary); color: var(--sf-color-text--on-secondary); }
@@ -180,7 +182,7 @@
180182
--sf-shadow-color: oklch(from var(--sf-surface-color) var(--sf-shadow-lightness) c h);
181183
}
182184
}
183-
.sf-scrim {
185+
.sf-scrim {
184186
position: relative;
185187
isolation: isolate;
186188
}
@@ -202,33 +204,33 @@
202204
.sf-scrim--bottom { --sf-scrim-direction: to top; }
203205
.sf-scrim--full { --sf-scrim-gradient: var(--sf-scrim-color); }
204206

205-
.sf-text-protect {
207+
.sf-text-protect {
206208
text-shadow: var(--sf-scrim-text-shadow);
207209
}
208210

209-
.sf-text-gradient {
211+
.sf-text-gradient {
210212
background-image: var(--sf-gradient-primary);
211213
background-clip: text;
212214
color: transparent;
213215
}
214216

215-
.sf-link-external::after {
217+
.sf-link-external::after {
216218
content: var(--sf-link-external-marker);
217219
display: inline-block;
218220
font-size: 0.85em;
219221
text-decoration: none;
220222
}
221223

222-
.sf-content-auto {
224+
.sf-content-auto {
223225
content-visibility: auto;
224226
contain-intrinsic-size: auto var(--sf-content-intrinsic-size, 500px);
225227
}
226228

227-
.sf-tabular-nums {
229+
.sf-tabular-nums {
228230
font-variant-numeric: var(--sf-font-numeric, tabular-nums);
229231
}
230232

231-
.sf-link--subtle:link,
233+
.sf-link--subtle:link,
232234
.sf-link--subtle:visited {
233235
text-decoration-line: none;
234236
}

core/motion.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
.sf-scale-down { animation: var(--sf-animation-scale-down); }
4040

4141

42+
/* animation-duration set unconditionally: without it, engines without
43+
animation-timeline snap to end state at 0s. */
4244
.sf-entrance--fade,
4345
.sf-entrance--fade-up,
4446
.sf-entrance--fade-down,

core/states.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
/* INTERACTIVITY */
2323

24+
/* cursor: not-allowed inherits to children with pointer-events: auto —
25+
intentional, part of the .is-disabled API surface. */
2426
.is-disabled {
2527
opacity: var(--sf-opacity-disabled);
2628
pointer-events: none;

core/themes.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
color: var(--sf-color-text);
2121
}
2222

23-
/* LumLocker */
23+
/* LumLocker: locks 4 brand colors to shared OKLCH L. Neutral/base excluded —
24+
forcing them to the same L breaks their semantic role. */
2425
@supports (color: oklch(from red l c h)) {
2526
:root[data-lumlocker] {
2627
--sf-color-primary: light-dark(
@@ -56,7 +57,8 @@
5657
}
5758

5859
/* SECTION-LEVEL THEMING */
59-
60+
/* light-dark() bakes at :root declaration time; re-declarations on [data-theme]
61+
elements are required for section-level theming to work. */
6062
@supports (color: oklch(from red l c h)) {
6163

6264
:root {

dist/badge-essential.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"label": "essential",
4-
"message": "15.6 kB gzip",
4+
"message": "56.2 kB gzip",
55
"color": "brightgreen",
66
"namedLogo": "css3"
77
}

dist/badge-optimal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"label": "optimal",
4-
"message": "17.9 kB gzip",
4+
"message": "64.1 kB gzip",
55
"color": "brightgreen",
66
"namedLogo": "css3"
77
}

optional/forms.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
opacity: 1;
6363
}
6464

65-
/* Autofill */
65+
/* Autofill: strips Safari's own dark-mode autofill background; Chromium/Firefox honour
66+
the CSS background without this, but WebKit doesn't. */
6667
/* stylelint-disable selector-pseudo-class-no-unknown */
6768
input:-webkit-autofill {
6869
box-shadow: inset 0 0 0 1000px var(--sf-color-surface);
@@ -108,7 +109,8 @@
108109
}
109110
}
110111

111-
/* Select */
112+
/* Select: chevron uses FieldText system color — custom properties don't propagate
113+
into data-URI SVG backgrounds. */
112114
select {
113115
padding-inline-end: calc(var(--sf-space-s) + 1.5em);
114116
}

0 commit comments

Comments
 (0)