Closed Bug 1267086 Opened 8 years ago Closed 4 years ago

XULAttr and XULAttrInc adds "id" that conflict with one another

Categories

(developer.mozilla.org Graveyard :: KumaScript, defect)

All
Other
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: frommozilla.comhash69, Unassigned)

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

Attachments

(1 file)

What did you do?
================
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/textbox#a-emptytext

What happened?
==============
Browser doesn't scroll to "emptytext" description

What should have happened?
==========================
It supposed to scroll to description of "emptytext" attribute.

Is there anything else we should know?
======================================
The problem is that Attributes template tag {{XULAttrInc()}} uses "a-" prefix in it's ID attribute:
https://developer.mozilla.org/en-US/docs/Template:XULAttrInc

The same "a-" prefix is used in IDs of hidden <code> html tags at "IN THIS ARTICLE" section of the page. Hence the browser scrolls to the first found section with such ID which is in "IN THIS ARTICLE" section.
Summary: TOC "In this article" section messes up anchored links for "Attributes" → "IN THIS ARTICLE" (TOC) section messes up anchored links for "Attributes"
Assignee: nobody → eshepherd
Keywords: in-triage
So yeah, there's something weird going on in the TOC ("IN THIS ARTICLE") box.

If you inspect it, you'll see that as V@no says, there's a hidden <code> element for every attribute, with an ID matching that of the block later in the article that contains the actual documentation for that attribute. These <code> elements are breaking the links and need to either go away or have the IDs removed.

Why are those <code> elements even in there, given that they're not seen? Seems like an unnecessary bloating of the page, unless there's a reason for them to be there that I don't get.
If they're there to support if the page gets its TOC depth changed (although that would be done at render time, you'd think, allowing it to be left out entirely), they still shouldn't have IDs on them.
Assignee: eshepherd → shobson
Can we at least get the bug status changed? or is it still unconfirmed?

Anyhow, here is a quick work around via userscript (tested with Greasemonkey), that changes "a-" id prefixes on <code> tags at TOC section to "ac-" (or the whole <code> elements can be deleted)
Status: UNCONFIRMED → NEW
Ever confirmed: true
We've redesigned the table of contents as a floating bar of the H1 elements (bug 1414107), and the link now goes to the "emptytext" description.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Still not good.
attribute "wraparound" scrolls to description of "number" attribute.

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/textbox#a-wraparound
Thanks for the reproduction steps, reopening and changing the title.

Searching the document, "a-wraparound" occurs 4 times:

* In "Attributes" section at the top of the document, as <a href="#a-wraparound">wraparound</a>
* In Attributes->Type -> Number, as <code id="a-wraparound"><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Attribute/wraparound">wraparound</a></code>.  This is added by {{ XULAttrInc("textbox.type") }}
* In Attributes -> wraparound, as <div id="a-wraparound">. This is added by {{ XULAttrInc("wraparound") }}, and it is probably the feature as designed.
* In Attributes -> wraparound, as <code id="a-wraparound">. Again, added by {{ XULAttrInc("wraparound") }}

XULAttrInc includes the content of other pages, in this case the wraparound page

https://github.com/mdn/kumascript/blob/master/macros/XULAttrInc.ejs
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Attribute/wraparound

In this page, the <code id="a-wraparound"> is added by XULAttr:

https://github.com/mdn/kumascript/blob/master/macros/XULAttr.ejs

XULAttr is used on 2743 English pages, and XULAttrInc on 336. I think the solution is to change XULAttrInc, and then fix pages like textbox that use it.

https://developer.mozilla.org/en-US/dashboards/macros

Alternatively, it is unclear why XULAttr should have an ID, so that may be the macro that should be adjusted to have a different ID, or preferably no ID.
Assignee: shobson → nobody
Status: RESOLVED → REOPENED
Component: Design → KumaScript
Resolution: FIXED → ---
Summary: "IN THIS ARTICLE" (TOC) section messes up anchored links for "Attributes" → XULAttr and XULAttrInc adds "id" that conflict with one another
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: REOPENED → RESOLVED
Closed: 6 years ago4 years ago
Resolution: --- → WONTFIX
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: