Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Rendering section for Lists to use the built-in 'list-item… #4816

Merged
merged 6 commits into from
Apr 28, 2021

Conversation

@MatsPalmgren
Copy link
Author

Actually, it might be better skip the last paragraph that I added (about <ol reversed>) and add that bit to CSS Lists instead since it affects the CSS used value, not the computed value. Also, it should probably be inhibited by contain:style as discussed in #4808 and we can include that too in CSS Lists so that there is one place that defines how the default value for the built-in list-item counter is determined. We can add a note here about <ol reversed> that links to that definition instead. WDYT?

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you ensure that the result builds?

I noticed that you deleted the pull request template. Can you edit your OP to reinstate it? It contains important information for determining whether we'll be able to merge this, such as whether there are web platform tests for the normative changes, or multiple implementers lined up to implement it.

Actually, it might be better skip the last paragraph that I added (about <ol reversed>) and add that bit to CSS Lists instead since it affects the CSS used value, not the computed value.

It's unclear to me whether the CSS specifications want to take dependencies on HTML elements, and specific HTML element names, in this way, or whether they want to be agnostic to the "host language". So far from what I've seen of CSS they prefer being agnostic, but you would probably have more experience than I.

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@zcorpan
Copy link
Member

zcorpan commented Mar 4, 2021

I've revamped this to address @domenic's comments, and to make <ol reversed> be rendered in terms of the yet-to-be-defined feature counter-reset: reversed(list-item). See w3c/csswg-drafts#4211 (comment)

source Show resolved Hide resolved
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work; thanks for this!

Could you say a bit more about the comparison with https://drafts.csswg.org/css-lists/#ua-stylesheet ? Specific things I wonder about:

  • ul { list-style-type: toggle(disc, circle, square); }
  • marker-side: match-parent; on ol, ul
  • text-align: match-parent; on li
  • The use of attr() and calc() instead of your algorithmic approach, and what the differences are.

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
is expected to use the following steps to treat the attributes as a <span data-x="presentational
hints">presentational hint</span> for the <span>'counter-reset'</span> property:</p>

<ol>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This algorithm is very nice and simple and clean. I worry a bit about whether it is in sync with the "ordinal value" definition. But, I can't think of any nice way to keep them in sync and make sure they reflect the same thing, because it's really comparing ordinal value to (this algorithm + CSS's automatic features like list-item incrementing).

Let me know if you have thoughts about ordinal value. Before, we spent effort defining ordinal value based on UA behavior to match the rendered output. Now that UA rendering is defined entirely in terms of CSS (and can, e.g., get out of sync with ordinal value via manually setting various CSS properties), it's not clear how to think of ordinal value's role. It gives a sense of what the semantics of the list are, but is it really OK for those semantics to drift visibly from the rendering? Which would we expect accessibility technology to use?

Copy link
Member

@zcorpan zcorpan Mar 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah ordinal value was indeed supposed to match browsers' rendering behavior, but now that mapping to CSS properties can do that, there's not so much of a need for ordinal value to do that. We could take the opportunity to completely decouple the semantic numbering from CSS. That CSS can be used to give a completely different visual compared to the semantics of the HTML is nothing new, and isn't an issue. On the contrary, having author CSS affect underlying semantics is against the spirit of CSS. I'll file an issue about ordinal value. (edit: #6473)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which would we expect accessibility technology to use?

ATs generally take CSS into account (e.g. don't expose display: none, do expose generated content), but there are tricky cases (like <td style="display: block"> should still be exposed cells in a data table, while <div style="display: table"> should not be exposed as a data table). For counters, I think users would expect the numbers to match visual rendering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fantasai interesting, thanks! Even with speak-as, though, the question is which number an AT should use -- the semantic number based on the HTML alone (or some combination of HTML+CSS), or the number the list item has per CSS counters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make it similar to the various bidi features, that have this language:

The following elements and attributes have requirements defined by the rendering section that, due to the requirements in this section, are requirements on all user agents (not just those that support the suggested default rendering)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@annevk I filed #6599 to track this

@zcorpan
Copy link
Member

zcorpan commented Mar 9, 2021

@domenic

Very nice work; thanks for this!

Thank you!

Could you say a bit more about the comparison with https://drafts.csswg.org/css-lists/#ua-stylesheet ? Specific things I wonder about:

  • ul { list-style-type: toggle(disc, circle, square); }

This doesn't match what browsers do -- a nesting of e.g. ol ul gives a circle marker, but this rule would give a disc marker, if I understand correctly.

https://html.spec.whatwg.org/multipage/rendering.html#lists
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/9010

  • marker-side: match-parent; on ol, ul
  • text-align: match-parent; on li

We could add these here, or in a follow-up. I haven't yet looked into what these do exactly.

  • The use of attr() and calc() instead of your algorithmic approach, and what the differences are.

So with this

ol[start] {
  counter-reset: list-item calc(attr(start integer, 1) - 1);
}

The value would be parsed with CSS rules instead of HTML rules, which makes a difference for e.g. start="1e10" or start="10xyz".

@domenic
Copy link
Member

domenic commented Mar 9, 2021

Awesome, that all makes sense. It'd be great to have tests for the start="1e10" or start="10xyz" cases to ensure nobody ever tries to switch their implementation to using attr().

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Will need tests, which should help inform implementation interest.

Also, @MatsPalmgren can you join https://github.com/mozilla-standards and publicize your membership therein?

@zcorpan zcorpan added the needs tests Moving the issue forward requires someone to write tests label Mar 11, 2021
zcorpan added a commit to bocoup/csswg-drafts that referenced this pull request Mar 11, 2021
This allows HTML to define the rendering for `<ol reversed>` in terms
of a presentational hint for `counter-reset: reversed(list-item)`
or `<ol reversed start=X>` to `counter-reset: reversed(list-item) X+1`.
See whatwg/html#4816

Fixes w3c#4181
Fixes w3c#4211
zcorpan added a commit to bocoup/csswg-drafts that referenced this pull request Mar 11, 2021
This allows HTML to define the rendering for `<ol reversed>` in terms
of a presentational hint for `counter-reset: reversed(list-item)`
or `<ol reversed start=X>` to `counter-reset: reversed(list-item) X+1`.
See whatwg/html#4816

Fixes w3c#4181
Fixes w3c#4211
source Show resolved Hide resolved
zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Mar 11, 2021
@zcorpan zcorpan removed the needs tests Moving the issue forward requires someone to write tests label Mar 12, 2021
@zcorpan
Copy link
Member

zcorpan commented Apr 20, 2021

I've filed browser bugs for this now, listed in OP. The spec change to CSS Lists needs review and CSS WG approval, and the tests for reversed() need review.

Also need clarify on implementer interest, which I think there is from Gecko and Chromium but I'm not the one to sign off on that.

@domenic
Copy link
Member

domenic commented Apr 20, 2021

@mfreed7 and/or @chrishtr are probably the right person to confirm for Chromium.

@chrishtr
Copy link
Contributor

Yes there is Chromium interest. I think @emilio also indicated Gecko interest, and I believe in fact Gecko already implements
lists using the CSS machinery.

@zcorpan
Copy link
Member

zcorpan commented Apr 20, 2021

w3c/csswg-drafts#6096 was merged, so I think this should be ready.

@smfr can you comment regarding interest/opposition for WebKit?

@zcorpan
Copy link
Member

zcorpan commented Apr 27, 2021

One week has passed. Should we merge?

@annevk
Copy link
Member

annevk commented Apr 28, 2021

Do you have a proposed commit message?

@zcorpan
Copy link
Member

zcorpan commented Apr 28, 2021

Define rendering of <ol><li> numbers in terms of CSS Lists

Map `<ol start reversed>` and `<li value>` to `counter-reset` and `counter-set`
properties as presentational hints. For reversed lists, use the CSS `reversed()`
function added in https://github.com/w3c/csswg-drafts/pull/6096

Tests:
https://github.com/web-platform-tests/wpt/pull/28040
https://github.com/web-platform-tests/wpt/pull/28453

I'm not certain whether #4808 is fixed by this PR, though technically it's up to CSS to define the interaction between contain: style and counters. (cc @vmpstr)

@annevk annevk merged commit 496413f into whatwg:main Apr 28, 2021
zcorpan added a commit to web-platform-tests/wpt that referenced this pull request Apr 28, 2021
* HTML: Test rendering of ol, ul, menu, li, dir, dl, dt, dd

See whatwg/html#4816
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request May 8, 2021
…, dir, dl, dt, dd, a=testonly

Automatic update from web-platform-tests
HTML: Test rendering of ol, ul, menu, li, dir, dl, dt, dd

* HTML: Test rendering of ol, ul, menu, li, dir, dl, dt, dd

See whatwg/html#4816
--

wpt-commits: bde70eda5074e031e4e57f4147bf9124f854ec20
wpt-pr: 28040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants