Skip to content

Use semantic tag elements wherever possible #579

@gadenbuie

Description

@gadenbuie

From the original discussion in #575 (comment)

[I think we should] use a <header> element [for the sidebar title]. We use role="complementary" on the sidebar div, which is equivalent to <aside> (and we should probably switch to using that element directly if we can). Within the aside, we can wrap the sidebar title in <header>, which will cause it to be announced appropriately as a banner even if the title element doesn't have a heading role. In the case when an author knows they should use an appropriately-leveled hX tag, e.g. h3(), they can still give the title argument that tag and the resulting markup is still a good choice – <header><h3>Sidebar Title</h3></header>.

This has led me consider a few more changes:

  • Instead of using <div role="main">, should we use an <article> element for the sidebar layout container?

  • Instead of <div role="complimentary"> we can use <aside> for the sidebar itself. I think this is a given if we switch to <article>.

  • Should page_navbar() use main()? In other page_() layout functions it's relatively easy to add main() tag (but we could also make that the default), but adding main() in page_navbar() is slightly trickier for the same reasons it has a sidebar argument.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions