bkardell / outline

3 stars 2 forks source link

Wanted: Speculative Polyfill(s) for h1-h6 re-leveling #7

Open bkardell opened 7 years ago

bkardell commented 7 years ago

As there is not one definitive spec and questions raised/decisions made by implementers that aren't 100% in agreement it's hard to say "polyfill that" but we need to come close as we can to something actually discussable and document that so that it can be discussed. It's perfectly fine if there are a couple of options with different, well documented characteristics that we can collect data on and weigh. The aim though should be as close as possible.

jonathantneal commented 7 years ago

I hope this begins to help.

https://github.com/jonathantneal/hxfill

At the time of this post, hxfill only re-levels headings according to outline — e.g. an h2 heading and an h3 heading within the same sectioning container will receive the same level, rather than the h3 being relatively lesser than the h2. I thought about getting more complex by allowing the headings to remain relative, but I decided against it because it confused me that these headings would calculate the same way:

<h1>This is a top-level H1 heading</h1>
  <p>This is some content elaborating on the H1</p>
  <h2>And this is a slightly lesser H2 heading</h2>
    <p>And this is some content elaborating on the H2</p>
    <aside>
      <h3>And this is an H3 heading probably the same level as the H2</h3>
      <p>Because the aside element ended the implicit section of the H2</p>
    </aside>
    <p>This content either elaborates on the H2, begins a new implicit section, or means nothing</p>

UPDATE: Added indentation to show how implicit sectioning mixed with explicit sectioning confused me.

bkardell commented 7 years ago

@jonathantneal can you write up a little more in there on which bits you feel it fills well, where the gaps with spec or where the spec is unclear etc. Then I think once we agree it's getting close we add this to the readme table and start documenting the results. Maybe @jakearchibald can either comment on or even help get closer?

jonathantneal commented 7 years ago

@bkardell, yes I will add this example to the README demonstrating why I did not mix implicit sectioning and explicit sectioning.

https://github.com/jonathantneal/hxfill#why-are-different-leveled-headings-in-the-same-section-getting-the-same-level

bkardell commented 7 years ago

Here is a way to view results of the test cases so far with that hxfill http://bkardell.com/outline/test-0.html... I can say that styling headings which may or may not have [aria-level] which may or may not disagree with their level and and may or may not have role[heading] seems... challenging.

Sorry if it seems I've been a little asleep at the wheel recently :(