Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

feat(css): Add example of @counter-style and all of its descriptors#2089

Merged
bsmth merged 15 commits intomdn:mainfrom
NiedziolkaMichal:counter-style
Aug 23, 2023
Merged

feat(css): Add example of @counter-style and all of its descriptors#2089
bsmth merged 15 commits intomdn:mainfrom
NiedziolkaMichal:counter-style

Conversation

@NiedziolkaMichal
Copy link
Copy Markdown
Member

@NiedziolkaMichal NiedziolkaMichal commented Apr 16, 2022

It adds interactive examples to @counter-style and all its descriptors except for speak-as, which doesn't have any visual impact.

image

image

image

image

image

image

image

image

image

image

@wbamberg
Copy link
Copy Markdown
Contributor

wbamberg commented Apr 16, 2022

Thanks for this PR, @NiedziolkaMichal ! I don't have time to review now, but:

  1. They don't work on firefox. It looks like latest version of firefox has an issue, with @counter-style and possibly other at-rules, be not operational, while being placed in shadow-root.

I remembered this after our conversation: #887 . Maybe the same thing?

@NiedziolkaMichal
Copy link
Copy Markdown
Member Author

Yes, it looks to be the same issue, although @font-face doesn't work on both firefox & chrome, while @counter-style works fine on chromium based browsers. Is there any way to make it work?

@wbamberg
Copy link
Copy Markdown
Contributor

@schalkneethling schalkneethling added Content:CSS issues related to CSS examples. community contributions by our wonderful community labels Apr 20, 2022
@schalkneethling
Copy link
Copy Markdown

@NiedziolkaMichal thank you for your continued contributions. I believe your recent pull request on mdn/bob will address the issues mentioned here? If so, let’s keep this one around until that one is merged. Thanks!

@NiedziolkaMichal
Copy link
Copy Markdown
Member Author

@schalkneethling No, this PR will still not work on Firefox, because output is presented in shadow tree. Recently I have been prototyping on replacing shadow DOM with iframe in HTML interactive examples. It would make it possible to use all at-rules and WebAPI examples, without much effort. Is there any important reason why you have chosen shadow dom instead?

@schalkneethling
Copy link
Copy Markdown

Is there any important reason why you have chosen shadow dom instead?

I honestly cannot remember :) I believe it could have been because we were, and still are, considering moving interactive examples into content without it being hosted in an iframe at all. We needed to prevent styling and Javascript "leaking" into the rest of the page.

@NiedziolkaMichal
Copy link
Copy Markdown
Member Author

@schalkneethling Making HTML examples be operational without either iframe or shadow DOM would be tricky. There are plenty of examples, like p, using selectors that would affect rest of the layout.

@schalkneethling
Copy link
Copy Markdown

@schalkneethling Making HTML examples be operational without either iframe or shadow DOM would be tricky. There are plenty of examples, like p, using selectors that would affect rest of the layout.

Yes, and so the hope/intent was that shadowDOM would shield us from this problem.

@wbamberg
Copy link
Copy Markdown
Contributor

There are I think 2 levels here:

  • the complete example, including the UI, code editors, and output
  • the output pane

At the moment the complete example is in an iframe, of course, and the output pane is in shadow DOM to stop it leaking into the editor UI. So even if the complete example was "inline" in the page, we'd need to isolate the output.

Recently I have been prototyping on replacing shadow DOM with iframe in HTML interactive examples.

That's interesting! So we'd have an iframe inside an iframe? I might have mentioned this a few thousand times before, but I'd love to have Web API interactive examples on MDN.

@schalkneethling schalkneethling requested review from a team, estelle and wbamberg and removed request for a team May 15, 2022 21:57
@wbamberg
Copy link
Copy Markdown
Contributor

@schalkneethling No, this PR will still not work on Firefox, because output is presented in shadow tree. Recently I have been prototyping on replacing shadow DOM with iframe in HTML interactive examples. It would make it possible to use all at-rules and WebAPI examples, without much effort. Is there any important reason why you have chosen shadow dom instead?

Hey, @NiedziolkaMichal , I have been trying to write this whole thing up and found this: #706 which is where we decided to use shadow DOM. It was also suggested there that an extra iframe could be a solution.

Just in case this bit of history could help :).

@NiedziolkaMichal
Copy link
Copy Markdown
Member Author

@wbamberg In the iframe PR, I believe that those issues don't exist. Applied CSS rules, don't select anything other than output. Clicking on links opens new browser tab. My solution also don't generate two separate documents, output exists only in memory and is applied via srcdoc attribute. On my device, I also didn't notice any performance issues.

@wbamberg
Copy link
Copy Markdown
Contributor

@wbamberg In the iframe PR, I believe that those issues don't exist. Applied CSS rules, don't select anything other than output. Clicking on links opens new browser tab. My solution also don't generate two separate documents, output exists only in memory and is applied via srcdoc attribute. On my device, I also didn't notice any performance issues.

Thanks for checking! It's great that your solution doesn't suffer from the possible problems discussed there.

@github-actions github-actions Bot added the idle Issues and pull requests with no activity for three months. label Dec 22, 2022
@NiedziolkaMichal NiedziolkaMichal mentioned this pull request Feb 10, 2023
94 tasks
@NiedziolkaMichal NiedziolkaMichal removed the community contributions by our wonderful community label Feb 26, 2023
@NiedziolkaMichal NiedziolkaMichal removed depends on shadow DOM fix idle Issues and pull requests with no activity for three months. labels Feb 26, 2023
@NiedziolkaMichal NiedziolkaMichal changed the title @counter-style and its descriptors feat(css): Add example of @counter-style and all of its descriptors Feb 26, 2023
@github-actions github-actions Bot added the idle Issues and pull requests with no activity for three months. label Mar 29, 2023
Copy link
Copy Markdown
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

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

Looks good. My suggestions include adding white space, using double quotes, and adding an example of a using a quote as a symbol.

I created a PR to add a comment about white space and quotes; so our example follow our best practices, but the content indicates that if you don't it should still work.

mdn/content#26677

Comment thread live-examples/css-examples/@counter-style/counter-style.css Outdated
Comment thread live-examples/css-examples/@counter-style/negative.css Outdated
Comment thread live-examples/css-examples/@counter-style/pad.css Outdated
Comment thread live-examples/css-examples/@counter-style/prefix.css Outdated
Comment thread live-examples/css-examples/@counter-style/range.css Outdated
Comment thread live-examples/css-examples/@counter-style/suffix.css Outdated
Comment thread live-examples/css-examples/@counter-style/symbols.css Outdated
@github-actions github-actions Bot removed the idle Issues and pull requests with no activity for three months. label May 10, 2023
@github-actions github-actions Bot added the idle Issues and pull requests with no activity for three months. label Jun 10, 2023
@github-actions github-actions Bot removed the idle Issues and pull requests with no activity for three months. label Jul 28, 2023
@bsmth bsmth requested a review from a team as a code owner August 18, 2023 10:43
@bsmth
Copy link
Copy Markdown
Member

bsmth commented Aug 18, 2023

My suggestions include adding white space, using double quotes

The formatter doesn't seem to like this, so I've added in f4c78a4 to make things green, I hope that's okay.

@bsmth bsmth requested a review from a team as a code owner August 18, 2023 12:47
@bsmth bsmth requested review from bsmth and removed request for a team August 18, 2023 12:47
Comment thread live-examples/css-examples/@counter-style/additive-symbols.css
Copy link
Copy Markdown
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

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

One suggestion open to prevent the line wrapping, but looks good aside from that, leaving a +1 👍🏻

@bsmth
Copy link
Copy Markdown
Member

bsmth commented Aug 23, 2023

Thanks everyone for the work! Merging shortly 🚢

@bsmth bsmth merged commit 2c4362a into mdn:main Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Content:CSS issues related to CSS examples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants