Filters are the busiest controls on a local directory. Someone lands on a city page with forty plumbers and narrows it down to the ones open on weekends that offer emergency service. On a static site those filters are usually a handful of checkboxes and a small script that hides cards that do not match. They are also one of the places where directory sites most often break for keyboard and screen reader users.
The fixes are not complicated, and most of them come from using plain HTML elements the way they were designed. This post walks through the markup, the script and the testing for filter controls on a static directory page.
Use native inputs, grouped with fieldset
Custom toggle chips built from styled divs look nice and are a pain to make accessible. You have to add roles, states, keyboard handling and focus styles by hand, and something usually gets missed.…