Making custom interactive components for web (more) accessible

Note: This post is older than two years. It may still be totally valid, but things change and technology moves fast. Code based posts may be especially prone to changes...

(Loaded 497 times)

Trying to set a baseline for making more accessible custom interactive components. Yes, you should refer to whole WCAG and I refer to it as well, but this can be used as a good baseline as well. Hope it can help somebody.

Current version of HTML (5.2) offers 111 different elements (or 113 if we count in svg and math, opens in new window), some of them pretty simple and some of them “full blown” components or widgets or whatever you prefer.

There is a golden rule of accessibility – to use native HTML element before re-creating it by yourself (better known as the First Rule of ARIA, opens in new window), but sometimes we just can’t use native HTML elements. Sometimes it’s the inability to style them as we want to (or are ordered to), and sometimes those native HTML element aren’t really accessible (yes, unfortunately some of them are still not accessible).

So there is a very high probability that we need to create some interactive component “from scratch”, and in this post I will try to set up a common framework that will give us better chances to make such custom widgets as accessible as possible.

Acceptance criteria for accessible custom interactive components

Acceptance criteria is quite a wide subject but let’s focus on the accessibility in this post. What must we consider to make our custom interactive components accessible. The answer is maybe quite obvious – we have to consider the whole Web Content Accessibility Guidelines (WCAG) that helps us with their baseline accessibility and then we also have to make sure to test such components with people with disabilities. Even better – invite people with disabilities from the start, where we define the functionalities and what the components need to do.

Unfortunately it’s not always possible to cooperate with people with disabilities on every step of creation, especially in smaller organizations and I like to be realistic about it. I really hope we will come that far, as a society and on organizational level, to really include people with disabilities and their lived experiences in all phases, from design to development, but it will take time to get there. I hope that WCAG version 3 will make the progress faster, but current reality is that it’s unfortunately not a common practice. So to try our best we have to rely on WCAG, community and accessibility veterans for now.

I like the concept of checklists, so here you go – a list that can be a checklist and will hopefully help with making your custom components (more) accessible.

  • Keyboard friendly – visible focus with proper contrast, all functions that can be done with mouse and touch must be possible with keyboard as well.
  • Semantic markup, when needed using ARIA, to have proper role, name, states and properties that are reflecting the reality.
  • Good enough contrasts and visible affordances like instructions and labels and feedback/error messaging (that is also announced properly to screen-readers), don’t rely on color alone, use also graphical symbols with good contrast and when needed alternative texts.
  • Support zoom, high contrast and when using animations respect the user’s preferences like reduced motion or have a setting to disable animations totally.

Please do audit the components internally and externally, test them with different assistive technologies and when your team is confident try to also test with people with different disabilities. And pay them fair for their time!

Hope this post will help you at least a bit. If it does, please reach out and if it doesn’t please let me know if I can improve something.

Author: Bogdan Cerovac

I am IAAP certified Web Accessibility Specialist (from 2020) and was Google certified Mobile Web Specialist.

Work as digital agency co-owner web developer and accessibility lead.

Sole entrepreneur behind IDEA-lab Cerovac (Inclusion, Diversity, Equity and Accessibility lab) after work. Check out my Accessibility Services if you want me to help your with digital accessibility.

Also head of the expert council at Institute for Digital Accessibility A11Y.si (in Slovenian).

Living and working in Norway (🇳🇴), originally from Slovenia (🇸🇮), loves exploring the globe (🌐).

Nurturing the web from 1999, this blog from 2019.

More about me and how to contact me: