🟢 An Aside about HTML <aside>

When HTML5 was the new kid in town, multi-sidebar blogs were also very popular. And the <aside> element seemed like the right choice for sidebars - but is it?

Let's learn a bit more about <aside>!
In terms of assistive technology, an <aside> is announced with the implicit role of "complementary".

In terms of semantics, an <aside> cannot live within <main>.

For example - it's not going to be the right choice for ad content that lives within a <main>'s <article>.
By actual definition per MDN:

"The HTML <aside> element represents a portion of a document whose content is only indirectly related to the document's main content."

So what type of content can live there?
Example things <aside> can be used for:

- colophon/bio information
- related resources
- lists of things that are extra bonus content

So it can be a "sidebar" as long as it's outside of <main>.

For multiples - add aria-label or aria-labelledby to help users of assistive tech.
An <aside> should not be used for:

- extra navigation - use <nav> with an aria-label identifying it such as "secondary"
- pull quotes - use <blockquote>
- imagery/graphs - consider <figure>
- meta info important to the content - consider <footer>
A note that whether or not <aside> can be within <main> seems to be a bit contested.

I added that point because it's flagged as a landmark error w/ @dequesystems aXe - so if anyone can clarify if there are exceptions, we can learn something new and use <aside> more effectively!
The <aside> is allowed a few additional ARIA roles.

So by default, it's not allowed within <main> due to "complementary" conflicting with the "main" landmark role, but you may nest it by using a role of "region" or "note".

See "Permitted ARIA roles":
developer.mozilla.org/en-US/docs/Web…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Stephanie Eckles

Stephanie Eckles Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @5t3ph

6 Mar
👩‍🏫 Quick thread on keyboard #a11y

If an interaction relies on a mouse-initiated action, it needs to be keyboard accessible too.

This means it may need to respond to Space and/or Enter as a trigger (hint: you get that for free with <button>).
If it opens something, it may need to close with Escape.

If it's scrollable, it needs to respond to Up/Down arrow keys.

If it's a group of related options (like autocomplete or tabs), it may need to respond to Up/Down or Left/Right arrow keys (search phrase: roving tabindex).
If it opens a dialog/modal, it needs to prevent tab access with elements outside of that experience (search phrases: "trapping focus" and "inert").

If it's interactive *at all* it needs to be able to gain keyboard focus, and that focus needs to have a visible style.
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!