Closed Bug 1937568 Opened 3 months ago Closed 1 month ago

Console warning when using h1 in article/aside/nav/section without author-defined font-size or block margins

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox135 --- wontfix
firefox136 --- fixed

People

(Reporter: zcorpan, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

See https://github.com/whatwg/html/issues/7867#issuecomment-2541654834

I envisioned logging a message when h1 in a sectioning element is rendered but doesn't have author-defined font-size or block margins. When the change has shipped everywhere, there's no need for the warning anymore.

This would need to differentiate author-origin styles vs UA-origin styles.

From discussion with :emilio

We have ways to know whether a property is author-specified
But it'd be a bit expensive having to walk the ancestor chain unconditionally

Maybe we can have a UA-origin-only custom property added to the UA stylesheet

:is(section, aside, article, nav) h1 { -moz-has-sectioning-ancestor: 1 }

Then check the value of that somewhere?

Well sure, that'd at least use the bloom filter I think
Still probably overkill

A use counter would be nice here also.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/da66c6c0feb4 Use counter and warning for <h1> inside section/etc with no margin or font-size. r=zcorpan,flod
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/73dd35269a01 Fix MDN link in console warning for h1 font-size. r=emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: