DEV Community

Discussion on: Creating a Sidebar with HTML, CSS and JS

Collapse
 
tfbiii profile image
Fred Buecker

I followed the ARIA link and this was very prominent in that page:

"Many of these widgets were later incorporated into HTML5, and developers should prefer using the correct semantic HTML element over using ARIA, if such an element exists. For instance, native elements have built-in keyboard accessibility, roles and states. However, if you choose to use ARIA, you are responsible for mimicking (the equivalent) browser behaviour in script."

Do you feel your specific implementation could be done with HTML5 vs ARIA?

Collapse
 
felipperegazio profile image
Felippe Regazio • Edited

Definitely yes, but you cannot completely get rid of ARIA. I tried to give a vague introduction to that point at: "If you're thinking about accessibility (and you should), you'll maybe need the nav or the aside tag, depending on the way - and where - you're implementing your sidebar".

If you replace the root element (div) with a "nav" tag, you'll already gain a lot in accessibility considering the HTML5 semantics, etc. The aria-hidden will be optional in that context, but you will still need the aria-label, the @bourhaouta solution would be ok using a "nav". You can carefully consider the "aside" tag if your sidebar content its not related to the page main content.