Please Stop Building Inaccessible Forms (and How to Fix Them)

See the original posting on DZone Python

I regularly find inaccessible forms. In this post we’ll check out one of the common accessibility problems and fix it.

Note, today’s blog post is very heavily inspired by the Labeling Controls tutorial from w3.org.

HTML is accessible by default. This is true, with the important caveat that when you use semantic HTML properly, what you’ve built will be accessible. Now, there are lots of ways that you can mess this up. Today I’m going to focus on <label> and how to ensure that your form controls (inputs) are properly labeled.