Accessible Components

Considerations and resources for making the best accessible components.

Michael Drotar
March 4, 2024 - 4 minutes

Accessibility is a simple concept on the surface with impossibly deep roots. And against common convention, it's an area where not trying at all is often better than trying and doing the wrong thing.

Fortunately, the W3C has us covered! I strongly recommend checking out their ARIA Authoring Practices Guide. And if you just need something right now, visit their Examples page to dive right into common examples complete with an interactive demo and all the html, css, and javascript necessary to make each one work.

ARIA Authoring Practices GuideExamples

These resources have been invaluable in my journey to making the web a more accessible place.

Years ago when I first found them, the examples were far fewer. Highly visual things like carousels were not covered so I would ask people to consider what else might serve the same purpose. Perhaps taking each individual slide and sprinkling them throughout a document or using explicit actions to move the slides rather than automating them (essentially a stylized tab group). Recently I noticed that this example was added, and I was happy to find that it has similar recommendations to my own.

There are also examples for tooltips (which are not friendly to touch devices), alerts (which can be very obtrusive on screenless devices), and lots of other common web components by today's standards along with considerations and recommendations on them. If you can't find an example of what you need, I would strongly encourage you to tweak what you need in order to match one of the examples.

Considerations of accessibility

In my experience, it's common for people to think of accessibility as just screen reader support or just aria attributes, but it goes well beyond that. Below I list some of the things that I think about with every new design that I approach:

  • input devices - mouse vs touch, physical keyboard vs on-screen keyboard or speaking device
  • output devices - screens vs screen readers or tactile devices
  • sizing and spacing - would someone with reduced mobility or a hand tremor be able to click this
  • contrast - would someone with reduced vision or color blindness be able to distinguish these
  • motion - does this help the user follow along or distract them
  • device size - how will this display on wide/short and tall/thin devices (also called responsiveness)

Accessibility is about everyone. Content should be available even on devices with slow processors or slow internet speeds. Like how an audiobook gives people an option to read or listen to something, accessibility should empower people to consume content in their preferred method.

I read once about how people with cognitive differences could interpret uppercase text less as a stylish design choice and more as being yelled at, and it would not be an enjoyable experience to have parts of the content randomly yelling at you to click here or read this. I'm not proposing that buttons should never use all caps, but I would urge anyone to consider the context it's being done in and if the trade-offs are worth it. And very importantly, ensure that the caps are implemented through CSS while the underlying content remains in sentence case so that screen readers can vocalize it appropriately.

Another often over-looked consideration is that our eyes are really good at scanning information, but when someone is using a screen reader or another assistive device, there's no layout or color to guide them. These devices will instead pick out content like headings as well as links and buttons to provide an outline to skim through, but if your document has 27 links all with the text "click here" then it loses all meaning. Instead, ensure that links are always distinct and descriptive. Instead of "For more information about accessibility guidelines, click here" try "The W3C offers amazing articles on accessibility guidelines." Or, like I've done with this article, separate your most important links to be as prominent as the information behind them is important. This will create a visual experience that is more similar to an auditory or other experience of the content as well.

The W3C again has excellent resources here to help you understand more about the people, tools, and techniques behind accessibility.

Accessibility Fundamentals