Skip to content

arriIsHere/audo-header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

audo-header

Keeping track of headers is hard and many web dev projects just don't bother. Using whatever heading level matches visually. This creates problems for screenreader users and those who navigate using the keyboard.

Auto-header fixes this problem by abstracting away the actual header levels. All you need to know is if you want to go down, up, or stay the same.

<h-same>Heading lvl 1</h-same>
<h-down>Heading Level 2</h-down>
<h-down>Heading Level 3</h-down>
<h-same>Heading level 3 again</h-same>
<h-up>Heading Level 2 again</h-up>
  • using the <h-down> component will set the heading one lower than it's predecessor.

  • <h-up> will bring the heading one level up.

  • and finally <h-same> will keep you at the same level.

Heading limits

The HTML5 spec outlines 6 heading levels. if you are already at heading level 6 and use a <h-down> it will behave the same way as if you had used an <h-same>.

<h-down>Heading level 2</h-down>
<h-down>Heading level 3</h-down>
<h-down>Heading level 4</h-down>
<h-down>Heading level 5</h-down>
<h-down>Heading level 6</h-down>
<!-- Heading level remains at 6 -->
<h-down>Heading level 6</h-down>

Similarly if you are already at heading level 1, using an <h-up> will behave like an <h-same> this is done to prevent going outside the spec.

<h-same>Heading level 1</h-same>

<!-- Heading level remains at 1 -->
<h-up>Heading level 1</h-up>

About

Simple repo to automatically advance, go back and in general keep track of your header levels. Contains react and web component versions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published