Accessibility
Republic aims for WCAG 2.2 level AA. Most of that comes from the tokens and the CSS, but a few rules depend on how you use them. Use this page as the checklist for every screen you build.
Contrast
Section titled “Contrast”- Text needs 4.5:1 against its background. This covers body text, labels, placeholders and text on buttons.
- Control boundaries need 3:1: the edge of an input, a checkbox or a selected tab, and the inner focus ring.
- Both rules apply in both themes.
- Exempt: disabled controls and disabled text (
--rp-color-text-faint,--rp-color-text-idle, anything at 40% opacity), and the gold focus halo, which is decoration.
The token build checks every text and control pair in both themes and fails if one falls short. Translucent colours are checked after they are laid over the surface they sit on. If you put text on a colour the build does not know about, check it yourself.
Every control that can take focus shows the focus ring when it has keyboard focus. The ring is an ink outline with a gold halo. The outline carries the contrast and survives high-contrast mode. See Focus.
- Never remove the ring without drawing the same ring another way.
- Make sure the order of focus follows the order of the page.
- Keep focus visible: do not hide it behind a sticky header or clip it with
overflow: hidden.
Word and shape
Section titled “Word and shape”Every status has a word and a shape, not only a colour. “Saved” with a check icon, “Failed” with a warning icon. Someone who cannot tell the colours apart still gets the meaning, and so does someone reading in high-contrast mode.
No colour-only meaning
Section titled “No colour-only meaning”Colour can support meaning but never carry it alone.
- A required field says “required” in words, not only with a red mark.
- A link in running text is underlined, not only coloured.
- A chart labels its lines or uses patterns, not only colours.
- An error names the problem in text next to the field.
Before you ship
Section titled “Before you ship”- Run an automated check such as axe on every page, in light and dark.
- Use the page with the keyboard only.
- Turn on a screen reader and listen to one full task.
- Zoom to 200% and check that nothing is cut off.