Open Josh-Cena opened 3 months ago
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.
Please don't forbid duplicate headings... This is a platform problem. Not a content problem.
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:
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:
EmbedLiveSample
s that use the same ID. I'm not sure why the iframe needs an ID at all; maybe we can just remove it. Otherwise we should have a parameter that sets the ID for the iframe.offset-path
is both adl
item and a formal syntax symbol.<calc-sum>
appears twice in the syntax. On https://developer.mozilla.org/en-US/docs/Web/CSS/offset,<offset-path>
appears twice, and with different expansions. Maybe it's pulling from multiple specs.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?
https://github.com/mdn/yari/issues/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