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

Duplicate IDs: can they be helped? #11529

Open
3 tasks done
Josh-Cena opened this issue Jul 23, 2024 · 2 comments
Open
3 tasks done

Duplicate IDs: can they be helped? #11529

Josh-Cena opened this issue Jul 23, 2024 · 2 comments
Labels
idle involves: Content Requires the attention of the Content team. macros tracking issues related to kumascript macros needs discussion p3 We don't have visibility when this will be addressed.

Comments

@Josh-Cena
Copy link
Member

Josh-Cena commented Jul 23, 2024

Summary

Sometimes, content generated by macros can have IDs that duplicate with what's already on the page. This makes the HTML invalid. I'm not sure if it can be helped, but just want to discuss because they are discovered by my checker.

URL

I have discovered 15 cases of duplicate IDs:

files/en-us/mdn/writing_guidelines/page_structures/live_samples/index.md
  Duplicate ID frame_iframe_size
  Duplicate ID frame_allowing_features
files/en-us/web/api/css_object_model/managing_screen_orientation/index.md
  Duplicate ID frame_adjusting_layout_based_on_the_orientation
files/en-us/web/css/@property/syntax/index.md
  Duplicate ID syntax
files/en-us/web/css/calc-sum/index.md
  Duplicate ID <calc-sum>
files/en-us/web/css/color/index.md
  Duplicate ID color
files/en-us/web/css/container-name/index.md
  Duplicate ID container-name
files/en-us/web/css/inset-area/index.md
  Duplicate ID inset-area
files/en-us/web/css/offset/index.md
  Duplicate ID <offset-path>
files/en-us/web/css/offset-path/index.md
  Duplicate ID offset-path
files/en-us/web/css/position-try/index.md
  Duplicate ID <inset-area>
files/en-us/web/css/position-try-fallbacks/index.md
  Duplicate ID <inset-area>
files/en-us/web/css/scrollbar-color/index.md
  Duplicate ID scrollbar-color
files/en-us/web/css/scrollbar-width/index.md
  Duplicate ID scrollbar-width
files/en-us/web/mathml/element/mfenced/index.md
  Duplicate ID frame_mfenced_example1

Reproduction steps

Go to one of the pages above, such as https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Page_structures/Live_samples, and in the console type document.querySelectorAll("#frame_iframe_size"). See that the list contains more than one item.

Expected behavior

IDs are globally unique

Actual behavior

IDs are not globally unique.

The reports can be divided into several cases:

I think, in general, we may be able to fix this by post-processing the HTML file and adding suffixes if IDs collide, but just want to bring it to your attention for discussion.

Device

Desktop

Browser

Chrome

Browser version

Stable

Operating system

Mac OS

Screenshot

No response

Anything else?

#5913 is a similar issue but not duplicate. I don't actually care about the final rendered MDN page; I only care about the content HTML, so if there are duplicate IDs in the site layout I won't report them.

Validations

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 23, 2024
@argl argl added involves: Content Requires the attention of the Content team. p3 We don't have visibility when this will be addressed. macros tracking issues related to kumascript macros needs discussion and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jul 29, 2024
@github-actions github-actions bot added the idle label Aug 28, 2024
@OnkarRuikar
Copy link
Contributor

OnkarRuikar commented Oct 8, 2024

Multiple EmbedLiveSamples that use the same ID.

In markdownlint we do have no-duplicate-heading enabled but we allow duplicates under different parent headers. Can we make the rule more strict? i.e. no duplicate headings at all. We can write a custom markdown lint rule that will flag all the duplicate headers except HTML, CSS, JS, Result etc. This will prevent two EmbedLivesample macros using same header.

For example on developer.mozilla.org/en-US/docs/Web/CSS/calc-sum, appears twice in the syntax ... Maybe it's pulling from multiple specs.

It is a bug because both the syntaxes have recursion in them. The syntax rendering code needs to check if the value/type has already been expanded.

@Josh-Cena
Copy link
Member Author

Please don't forbid duplicate headings... This is a platform problem. Not a content problem.

@github-actions github-actions bot removed the idle label Oct 9, 2024
@github-actions github-actions bot added the idle label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle involves: Content Requires the attention of the Content team. macros tracking issues related to kumascript macros needs discussion p3 We don't have visibility when this will be addressed.
Projects
None yet
Development

No branches or pull requests

3 participants