Csswg-drafts: [css-color-3] opacity should use <<number>> not <<alphavalue>> “which is syntactically a <<number>>”

Created on 24 Sep 2018  Â·  11Comments  Â·  Source: w3c/csswg-drafts

The value of opacity looks and behaves exactly as a <<number>>. It should be defined as actually being a <<number>>, so that it's clear. This will hook into future specs like Animations more correctly.

This should just be an editorial change.

Closed Accepted as Obvious Bugfix css-color-3 css-color-4

Most helpful comment

ping @fantasai @tabatkins @AmeliaBR do we:

  1. remove <alphavalue> and replace it with <number> | <percentage>
  2. define <alphavalue> as <number> | <percentage> (and do what to make animations work)?

I'd like to close off this issue, get Color 4 updated and Color 3 errata'ed.

All 11 comments

I think that comment also applies to CSS Color 4 definition of opacity

This would be an erratum on Color 3, but an editorial change on Color 4.

I'm fine with killing <alphavalue>, but note that it's now equivalent to <number> | <percentage>, not just <number>.

Note that SVG 2 currently references the <alphavalue> type for various properties. So if you decide to kill it, please make sure that an issue (or ideally a PR) gets filed on SVG to match up.

But I do agree that, since the limits on the value are not enforced by the parser, it is grammatically simpler to just use the raw data types. The benefit of having a designated type really only comes in when you start trying to parse the syntax for the color functions, where it helps explain the meaning of the value.

The benefit of having a designated type really only comes in when you start trying to parse the syntax for the color functions, where it helps explain the meaning of the value.

Yes, I thought that was the point. I hadn't realized it would somehow affect the animation spec (and don't understand why it would).

It seems desirable (for readability, for cross-spec linking and consistency) to say that something is an &lt;alphavalue.. Can't we just (continue to) define the term, and the definition is <number> | <percentage> ? Would that still work for animation to be correctly defined?

ping @fantasai @tabatkins @AmeliaBR do we:

  1. remove <alphavalue> and replace it with <number> | <percentage>
  2. define <alphavalue> as <number> | <percentage> (and do what to make animations work)?

I'd like to close off this issue, get Color 4 updated and Color 3 errata'ed.

re-ping @fantasai @tabatkins @AmeliaBR

I don't see any problem with continuing to define <alphavalue> as an intermediate syntax for the specs. Animations should still be fine.

The fact that it is now a union of two types makes it much more useful to continue to have a shorthand syntax.

Agreed; I think it's useful to leave it as a production to ensure consistency.

Animation isn't an issue; animations drill down to the base values of any production to figure out how to animate if needed.

Note, tho, that you can't animate between number and percentage naively, because they can't be combined in calc(). We should probably specially define this to allow animation with them, since they're equivalent - either converting both to a number or both to a percentage. We can reuse the language from https://drafts.csswg.org/css-values/#combine-numbers et al.

We should probably specially define this to allow animation with them, since they're equivalent

I think that's already handled by saying the percentages compute to numbers, isn't it?

Ah, I missed that. Yes, we're cool then.

Was this page helpful?
0 / 5 - 0 ratings