Menu

Building Accessible Filter Controls for a Static Directory
📰

Building Accessible Filter Controls for a Static Directory

DEV Community: html·SBD Marketing·8 days ago
#lQLUIdS8
#devto2#devto#dev#filters#directory
Long article (1096 words) — no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.