mdn / yari

The platform code behind MDN Web Docs
Mozilla Public License 2.0
1.17k stars 498 forks source link

`linear-gradient()` Formal syntax is outdated #11483

Open gibson042 opened 1 month ago

gibson042 commented 1 month ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient

What specific section or headline is this issue about?

Formal syntax

What information was incorrect, unhelpful, or incomplete?

The content appears to correspond with CSS Images Module Level 3 rather than the current CSS Images Module Level 4, and in particular is missing the <color-interpolation-method> = in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? ] and <linear-color-stop> = <color> <color-stop-length>? and <color-stop-length> = <length-percentage>{1,2} productions that support color space interpolation and two-position color stops (which are used elsewhere on the page).

What did you expect to see?

Syntax defined in CSS Images Module Level 4, e.g.

<linear-gradient-syntax> =
  [ [ <angle> | to <side-or-corner> ] || <color-interpolation-method> ]? ,
  <color-stop-list>

<side-or-corner> = [left | right] || [top | bottom]

<color-interpolation-method> =
  in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? ]

<color-stop-list> =
  <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#

<rectangular-color-space> =
  srgb | srgb-linear | display-p3 | a98-rgb | prophoto-rgb | rec2020 | lab |
  oklab | xyz | xyz-d50 | xyz-d65

<polar-color-space> = hsl | hwb | lch | oklch

<hue-interpolation-method> = [ shorter | longer | increasing | decreasing ] hue

<linear-color-stop> = <color> <color-stop-length>?

<linear-color-hint> = <length-percentage>

<color-stop-length> = <length-percentage>{1,2}

<length-percentage> = <length> | <percentage>

Do you have any supporting links, references, or citations?

As provided above:

Do you have anything more you want to share?

Related issues:

Josh-Cena commented 1 month ago

Hi! Our format syntax is pulled from webref, and it seems they haven't updated yet: https://github.com/w3c/webref/blob/32a07580b0927359ef6ed62f72999e9e5fb86304/ed/css/css-images.json#L187 once they have the new syntax, MDN will update automatically.

gibson042 commented 1 month ago

That css-images.json file is for CSS Images Module Level 3, as indicated on line 3. Its level 4 sibling file is already correct: https://github.com/w3c/webref/blob/32a07580b0927359ef6ed62f72999e9e5fb86304/ed/css/css-images-4.json#L172-L177

Cf. https://github.com/mdn/content/issues/23718#issuecomment-1386557393

Based on the issue raised at CSSWG, this issue is caused by the spec link pointing to editor's draft of CSS Images Module without a specific level, which effectively points to the content of Level 3, but the double-position syntax is actually defined in Level 4.

Josh-Cena commented 1 month ago

I see. Thanks for the additional context. If https://github.com/mdn/browser-compat-data/pull/18699 already fixed the spec link, I'm unsure why the syntax is still from level 3.

wbamberg commented 1 month ago

I believe this is about the algorithm that decides which spec we use for the formal syntax, and is really a part of https://github.com/orgs/mdn/discussions/442.

Josh-Cena commented 1 month ago

Is there anything actionable in content? I'm unsure what to change.

wbamberg commented 1 month ago

Is there anything actionable in content?

No. We could transfer this to Yari I suppose. but a real systematic fix crosses both Yari and content and potentially BCD as well.

estelle commented 1 month ago

@bsmth @pransh15 can we move this issue to Yari?