DEV Community

Chris Westbrook
Chris Westbrook

Posted on

1 1

accessibility tips from an accessibility engineer

I am a blind accessibility engineer and programmer and I thought I would write an article detailing some of the common things I see in my day job. Accessibility may seem overwhelming, but it doesn't have to be. So here are three things you can do to improve your website's accessibility right away.

  • use semantic html
    If something should be a button, make it a If something should be a link, make it a link. Don't use purely clickable divs to indicate actions. If you must make a custom web control, reach for a library that has implemented aria best practices. There are a lot of complications to using aria correctly, and why reinvent the wheel?

  • label form fields
    It is super important to label form fields. Otherwise, people using assistive technology may not understand which fields need which data. Labeling is typically done using the tag which takes the id of the form field as the for attribute and wraps the visible label. For example:

<label for="firstName">First Name</label>
<input type="text" id="firstName" name="firstName"/>
Enter fullscreen mode Exit fullscreen mode

You may also use the aria-describedby attribute, which takes the id of a div/span htat describes the control. This is typically used to add additional instructions to a form field or convey validation errors.

  • properly mark up modals and set focus to them You need to set focus to an element inside a modal dialog when it opens, otherwise people using assistive technology will have no clue that your modal opened. Also decorate your modal with the role="dialog" and aria-modal="true" attributes. Ensure that users cannot escape the modal by tabbing out of it into the page content behind it. A good library should take care of this for you.

I hope this short post has been helpful. Please leave feedback/questions in the comments.

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay