Re: [w3ctag/design-reviews] Alternative Text for CSS Generated Content (#351)

> one question is whether or not it would be useful for the alt to be inheritable, but only change out the image.

The original proposal, to have a separate `alt` property, would have supported this (and as a side effect, would have avoided backwards compatibility issues):

```css
.warning::before {
  content: url(scorpion.svg);
  alt: "warning, ";
}
:lang(fr).warning::before {
  alt: "attention, ";
}
[data-theme=simple] .warning::before {
  content: "⚠";
}
```

But it was decided that this was an anti-pattern: the risk of content and alt text getting out of sync was considered more significant than the benefit of sometimes being able to apply the same alt text for different images or different alt text for the same images.  As developers update their CSS, they could override `content` with different selectors, but forget to override `alt` to match.

See discussion here (and other replies in this thread), which seem to be the original source of the proposal to combine the alt text into the `content` property: https://lists.w3.org/Archives/Public/www-style/2014Nov/0046.html


There is a follow-up explanation in this thread: https://lists.w3.org/Archives/Public/www-style/2016May/0103.html


I'm not 100% convinced that this justifies the loss of flexibility, but I agree that there are limitations either way. And with the current spec, if an author needs the same alt/image for multiple content declarations, it can be coordinated using CSS variables.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/351#issuecomment-491316948

Received on Friday, 10 May 2019 14:52:00 UTC