Styling and accessibility are often at odds with each other. Scott O’Hara has this repo that shows how the two can work really well together in the context of form controls.
The trade-offs between native and styled controls remind me of Eric Bailey’s case study on focus styles:
A common misconception is that the focus style can only use the outline property. It’s worth noting that
:focusis a selector like any other, meaning that it accepts the full range of CSS properties. I like to play with background color, underlining, and other techniques that don’t adjust the component’s current size, so as to not shift page layout when the selector is activated.
The nice thing about Scott’s repo is that it serves as a baseline that can be pulled into a project and customized from there. Sort of like WTF, forms? but with a clear—ahem—focus on accessibility. Styles are considered, but less the point.
While we’re on the topic, let’s not let Dave Rupert’s “Nutrition Cards for Accessible Components” go unnoticed. It also shipped recently and—aside from being a clever idea—is a truly useful thing to reference the accessibility expectations of specific components. Definitely worth a bookmark. 🔖