- From: Karl Dubost via GitHub <noreply@w3.org>
- Date: Tue, 12 May 2026 08:21:33 +0000
- To: public-svg-issues@w3.org
karlcow has just created a new issue for https://github.com/w3c/svgwg:
== `:visited { fill: url(<ref>) <color> }` — should the color fallback apply when the URL is suppressed for privacy? ==
### Summary
SVG paint grammar allows `<url> <color>` as a value for `fill` and `stroke`,
where the `<color>` is used when the referenced paint server cannot be
applied. Browsers restrict `:visited` styling to privacy-safe values and
universally suppress URL paint servers in the visited state. When the
visited paint is written as `url(<ref>) <color>` (URL with color fallback),
engines disagree about whether the fallback `<color>` applies.
### The testcase
```html
<svg><defs>
<linearGradient id="g"><stop stop-color="lime"/><stop offset="1" stop-color="green"/></linearGradient>
</defs></svg>
<style>
a:link circle { fill: red; }
a:visited circle { fill: url(#g) blue; }
</style>
<a href="<already-visited-url>">
<svg viewBox="0 0 100 100" width="100"><circle cx="50" cy="50" r="45"/></a>
```
Expected: some well-defined rendering when the link is visited.
### Observed rendering (2026-05)
| Engine | Rendering of the circle in `:visited` |
|---|---|
| Blink (Chrome) | **solid blue** — URL suppressed, color fallback applied |
| Gecko (Firefox) | **red** — entire visited paint dropped, `:link` value used |
| WebKit (Safari) | **red** — entire visited paint dropped, `:link` value used |
WebKit tracks this in https://bugs.webkit.org/show_bug.cgi?id=70006 with a
`FIXME` at `LegacyRenderSVGResource.cpp:80`: "This code doesn't support the
uri component of the visited link paint." Blink and Gecko have not, to my
knowledge, formally taken a position; the behavior appears to fall out of
each engine's visited-link handling code.
### Why this is ambiguous
- CSS Selectors 4 §14 ("Visited links and history privacy")
https://drafts.csswg.org/selectors-4/#visited-privacy permits UAs to
restrict which properties and values can change in `:visited` rendering,
but does not prescribe how composite values such as `<url> <color>` are
to be decomposed.
- SVG 2 "Specifying paint"
https://svgwg.org/svg2-draft/painting.html#SpecifyingPaint defines the
color fallback as used when the URL reference does not identify an
available paint server. The question is whether "suppressed for privacy
in the visited state" counts as "not available" for fallback purposes.
Both readings are defensible. The spec is silent on the interop question.
### Why it matters
Authors who want to keep a consistent visual treatment for links in
`:link` and `:visited` while overriding just the fill color often reach
for the `url(<ref>) <color>` syntax (e.g. "use my brand gradient in the
normal state, but collapse to a darker color once the user has visited").
The current three-way divergence silently breaks that pattern on two of
three engines.
It is also a privacy question worth resolving on the record: applying the
bare color fallback in the visited state does not introduce any history
side channel beyond what plain `:visited { fill: <color> }` already
exposes, so suppressing it is a UA choice that the spec could normatively
either require or forbid.
### Requested resolution
Please clarify in SVG 2 §"Specifying paint" (or in coordination with CSS
Selectors 4 §14) what a UA should render when the `:visited` paint is
`url(<ref>) <color>` and the UA suppresses the URL component for privacy.
Two reasonable options:
1. **Apply the color fallback.** Consistent with SVG's existing fallback
semantics and with Blink. Unlocks the authoring pattern above.
2. **Drop the entire visited paint.** Consistent with WebKit and Gecko.
Treats the whole composite value as URL-bearing and therefore
non-privacy-safe.
Either answer is implementable; an explicit spec sentence plus a WPT test
would be sufficient to close the interop gap.
### Companion WPT
Draft test: `svg/painting/visited-url-fallback-color.tentative.html`
(reftest against a solid-blue `<circle>`, to land once the WG picks an
answer).
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1107 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 12 May 2026 08:21:38 UTC