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

replace current outline algorithm with one based on heading levels #7829

Merged
merged 45 commits into from
Jul 1, 2022

Conversation

stevefaulkner
Copy link
Contributor

@stevefaulkner stevefaulkner commented Apr 17, 2022

This PR is an attempt to bring the HTML spec in line with the decade+ old reality of non-implementation of the outline algorithm in User Agents and the continued presence of misleading content in the HTML spec relating to the outline algorithm.

Notes:

  • Removed outline algorithm section
  • Updated hgroup definition to reflect what it actually does/is
  • Updated numerous code examples to reflect Heading semantics as implemented in User agents
  • Updated/removed outline related cruft.

Relates to:

The CSS UA styles partial implementation has been left as is
https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings

Why partial? refer to https://codepen.io/stevef/pen/ZEvmNPg

  • At least two implementers are interested (and none opposed):
  • The issue at hand is no implementers have shown any interest in implementing for 10+ years
    • Chrome: …
    • Firefox: …
    • Safari: …

/dom.html ( diff )
/form-elements.html ( diff )
/grouping-content.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )
/interactive-elements.html ( diff )
/links.html ( diff )
/sections.html ( diff )
/tables.html ( diff )

@JamieKnight
Copy link

+1. Within the BBC we have to specifically inform devs that the spec does not represent what is implemented or planned to be implemented. For us at least, this change would have positive real world impact.

@aarongustafson
Copy link
Contributor

This deeply saddens me, but it's the right thing to do.

@yatil
Copy link

yatil commented Apr 17, 2022

100% support for this. Maybe removing the outline algorithm makes it possible to find solutions for its use cases that can and will actually be implemented.

source Outdated Show resolved Hide resolved
@domenic
Copy link
Member

domenic commented Apr 18, 2022

As discussed in the thread you link to, we cannot remove the outline algorithm, as documents still have outlines. It instead needs to be based on heading levels, without sectioning complications.

@Alohci
Copy link

Alohci commented Apr 18, 2022

It's hard to see why it's better to keep an outline algorithm that's totally wrong with respect to the outline that documents actually have, than to simply remove it. There's certainly a case for adding back in an algorithm that describes the true outline accurately, but I don't see why the lack of the latter precludes the former.

used modified text of @annevk PR headings and sections section whatwg#3499
general clean up and closer alignment with @annevk PR whatwg#3499
@stevefaulkner
Copy link
Contributor Author

@domenic wrote

As discussed in the thread you link to, we cannot remove the outline algorithm, as documents still have outlines. It instead needs to be based on heading levels, without sectioning complications.

additional commits add simplified version of outline in @annevk's PR #3499

@stevefaulkner stevefaulkner changed the title removes outline algorithm replace current outline algorithm with one based on heading levels Apr 18, 2022
@domenic
Copy link
Member

domenic commented Apr 18, 2022

Great! Let us know when the conflicts with the main branch are resolved and then we can work on review.

@stevefaulkner
Copy link
Contributor Author

@domenic conflicts resolved

source Outdated Show resolved Hide resolved
@domenic
Copy link
Member

domenic commented Apr 19, 2022

Thanks. Could you also make sure the build passes?

@stevefaulkner
Copy link
Contributor Author

Thanks. Could you also make sure the build passes?

@sideshowbarker said he would take a look at that

@stevefaulkner
Copy link
Contributor Author

@domenic

Could you also make sure the build passes?

Thanks to @sideshowbarker build now passes

@sideshowbarker sideshowbarker force-pushed the outline-reality-reset branch from 83bc19d to e230b44 Compare April 20, 2022 09:04
This error seems to have been introduced in f5def65,
whatwg#7475 — so it’s unclear why CI didn’t
catch it there.
Changing the spec source markup to use a p element in hgroup will need
to wait until after the spec change lands.
@sideshowbarker sideshowbarker force-pushed the outline-reality-reset branch from e230b44 to d7a8d50 Compare April 20, 2022 09:10
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@SaekiTominaga
Copy link

Hello, I have a question.

What is the difference between a rank and a level in a heading?

<h1>-<h6> were called "level" in HTML4.

In HTML5 and HTML LS, they are called "rank".
However, the current outline algorithm also uses the term "level".

This time, the term "heading level" has been restored in the Headings and sections but "rank" is still used for heading elements.

@myakura
Copy link

myakura commented Apr 21, 2022

Hey @SaekiTominaga ,

IIRC rank is a concept to determine the level of the heading in a corresponding section. They are not the same thing.

Suppose there is a document with three headings:

<h1>h1</h1>

<h2>h2</h2>

<h2>h2</h2>

This would create the following outline:

  1. h1
    1. h2
    2. h2

Now, if you change the first h2 to h3, what would the outline be?

<h1>h1</h1>

<h3>h3</h3>

<h2>h2</h2>

It might be surprising but this would yield the same outline (except the text) per the current algorithm.

  1. h1
    1. h3
    2. h2

In this case, the rank in the heading of the first subsection is three, but the level of the heading is two.

estelle pushed a commit to mdn/content that referenced this pull request Aug 15, 2023
In the current version of the spec, the `body` element belongs to no content category. The sectioning root concept has been removed entirely from the HTML spec in this PR: whatwg/html#7829
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
document conformance impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation normative change
Development

Successfully merging this pull request may close these issues.