Skip to content

Commit b5d1f2d

Browse files
quantbaiclaude
andcommitted
viz: actually suppress rectangular focus on SVG paths (box-shadow culprit)
Previous fix targeted outline only, but the rectangular cyan box was the box-shadow from the global :focus-visible rule: Chrome renders both outline AND box-shadow on SVG <path> as the path's bounding-box rectangle, ignoring the arc geometry. Fix at source: change global :focus-visible to :focus-visible:not(path) so the rule simply does not match SVG paths in the first place. Path focus is now exclusively handled by the dedicated path[role="button"] rule using stroke (which follows the arc shape). Added !important on path outline/box-shadow override to defend against any other selector that may target SVG paths in the future. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5d8f782 commit b5d1f2d

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

docs/style.css

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,26 @@ input {
155155
border: 0;
156156
}
157157

158-
/* Focus ring — WCAG 2.4.13 compliant */
159-
:focus-visible {
158+
/* Focus ring — WCAG 2.4.13 compliant.
159+
Excludes <path> because Chrome renders both `outline` and `box-shadow` on
160+
SVG <path> as the path's bounding-box rectangle, which ignores the arc
161+
geometry of sunburst wedges. Paths get their own stroke-based focus ring
162+
in the dedicated rule below — the stroke follows the path geometry. */
163+
:focus-visible:not(path) {
160164
outline: 2px solid var(--accent);
161165
outline-offset: 2px;
162166
box-shadow: 0 0 0 4px var(--focus-ring);
163167
}
164168

165-
/* SVG paths (sunburst wedges): rectangular outline does not follow the arc
166-
shape. Suppress browser default and use stroke as focus indicator — stroke
167-
follows the path geometry, giving a curved focus ring that matches the
168-
wedge. WCAG 2.4.13: 2.5px stroke change, 3:1 contrast vs unfocused state. */
169-
path[role="button"] { outline: none; }
169+
/* SVG path focus indicator (sunburst wedges) — stroke follows arc shape. */
170+
path[role="button"] {
171+
outline: none !important;
172+
box-shadow: none !important;
173+
}
170174
path[role="button"]:focus,
171175
path[role="button"]:focus-visible {
172-
outline: none;
173-
box-shadow: none;
176+
outline: none !important;
177+
box-shadow: none !important;
174178
stroke: var(--accent);
175179
stroke-width: 2.5;
176180
}

0 commit comments

Comments
 (0)