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

[CSS] Implement CSS Lists counter-reset: reversed #10856

Closed
5 of 8 tasks
Rumyra opened this issue Nov 29, 2021 · 4 comments
Closed
5 of 8 tasks

[CSS] Implement CSS Lists counter-reset: reversed #10856

Rumyra opened this issue Nov 29, 2021 · 4 comments
Assignees
Labels
Content:CSS Cascading Style Sheets docs fx release archive A closed issue relating to firefox release notes for developers.

Comments

@Rumyra
Copy link
Collaborator

Rumyra commented Nov 29, 2021

Acceptance Criteria

  • The listed features are documented sufficiently on MDN
  • BCD is updated
  • Interactive example and data repos are updated if appropriate
  • mdn/data updated
  • The content has been reviewed as needed

For folks helping with Firefox related documentation

  • Set bugs to dev-doc-complete
  • Add entry to Firefox release notes if feature is enabled in release
    or
  • Add entry to Firefox experimental features page if feature is not yet enabled in release

Features to document

Implement CSS Lists conter-reset: reversed(list-item) and

    /
      default style per spec

      Related Gecko bugs

      https://bugzilla.mozilla.org/show_bug.cgi?id=1706346

@Rumyra Rumyra added Content:CSS Cascading Style Sheets docs Firefox 96 labels Nov 29, 2021
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Nov 29, 2021
@hamishwillee hamishwillee self-assigned this Dec 17, 2021
@sideshowbarker sideshowbarker removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 17, 2021
@hamishwillee
Copy link
Collaborator

hamishwillee commented Dec 17, 2021

I think I understand this, but I'm seeing some inconsistent behaviour. Discussion kicked off in https://bugzilla.mozilla.org/show_bug.cgi?id=1706346

In summary, counter-reset allows you to specify a counter name and initial value like this:

counter-reset:  <counter-identifier> 7 //counter with initial value 7
counter-reset:  <counter-identifier> //counter with initial value zero

or you can specify none instead of an integer value to reset the counter).

counter-reset:  mycounter none

What has changed with this PR is that you can specify reversed(<counter-identifier>) s your counter identifier, and the new counter that is created/reset has the reversed flag set.

counter-reset:  reversed(mycounter) 7 //Reversed counter with initial value of 7
counter-reset:  reversed(mycounter) //Reversed counter with initial value of "the number of elements"

This feature has then been used to implement the "special" counter used for lists - list-item. So now <ol reversed> depends on this behaviour.

So lists behave as you would expect. You can reverse them in HTML using the reversed attribute, or in CSS using counter-reset: reversed(list-item).

There is a small "confusion" with reversed items in that if you use list-item then the counter automatically decrements and increments for counters. However if you have your own counter you must specify the counter as incrementing or decrementing manually using counter-increment. In other words there isn't any real difference between a reversed or non-reversed counter other than the default value set - you can have a forward counter and make it reverse with counter-increment

@hamishwillee hamishwillee changed the title [CSS] Implement CSS Lists conter-reset: reversed [CSS] Implement CSS Lists counter-reset: reversed Dec 17, 2021
@hamishwillee
Copy link
Collaborator

hamishwillee commented Dec 21, 2021

@Rumyra Would appreciate your advice on interactive examples.

This has an example counter reset here: https://github.com/mdn/interactive-examples/tree/main/live-examples/css-examples/lists

counter-reset.html allows you to select CSS for counter-reset to apply to an element in a list. This then applies to all the peers at the same level for numbering. The actual numberin gis then done in counter-reset.css using the counter-increment on H2.

Two problems. I can't work out how we might conditionally change the counter-increment based on the selection in the html. That means I can't change it to reverse. Or rather I can, but only if I change this to an ordered list, which is kind of only "half the story". Second problem is that only Firefox supports this, so you'll get annoying behaviour on other things.

I was thinking of fixing this by leaving the interactive example alone and just adding a simple embedded live example. Seem reasonable?

@Rumyra
Copy link
Collaborator Author

Rumyra commented Dec 22, 2021

I was thinking of fixing this by leaving the interactive example alone and just adding a simple embedded live example. Seem reasonable?

Having checked the page I think this is a very good way to go. The interactive example is just going to be finiky otherwise 👍

@hamishwillee
Copy link
Collaborator

hamishwillee commented Dec 30, 2021

Status

OK, I think the bulk of the work needed for this is done. Obviously we could continue forever with examples and some would be welcome. However I suspect others might do a better job than me at that.

@Rumyra Rumyra closed this as completed Jan 17, 2022
@bsmth bsmth added fx release archive A closed issue relating to firefox release notes for developers. and removed Firefox 96 labels Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs fx release archive A closed issue relating to firefox release notes for developers.
Projects
None yet
Development

No branches or pull requests

4 participants