Check Contrast and Zoom

Every link, button, and field on the sign-up page now has a name that a screen reader can announce. Many visitors read the page with their own eyes instead, less sharply than you: Mei on a phone in bright sunlight, Tomás at 200 percent zoom, and Jamal, who can’t tell red from green.

In this lesson, you’ll check the form’s contrast, its messages without color, and its layout at 200 percent zoom and 320 pixels, and fix the one problem these checks turn up. Start with the colors, because you can measure them.

Measure the Form’s Contrast

Contrast is a number you can read off. In the Styles pane, click the color square in front of a color value, and the picker shows its contrast ratio against the background. The Web Content Accessibility Guidelines, or WCAG, require at least 4.5:1 for text at their AA conformance level.

Type mei.lin into Email and press Tab, so the error message appears. Select its <span> and click the square before var(--error) in .error-message: 6.63, with a green check beside AA: 4.5.

A field’s border and the focus outline aren’t text, so WCAG asks for 3:1 against the colors next to them. The picker only measures a color, so borrow a paragraph on the page’s honeydew.

Select Rosa needs to know who’s coming, and in element.style {} at the top of the Styles pane, type color: var(--green), the borders’ color: 6.77. Change it to var(--focus), the outline’s color: 7.52.

Both clear 3:1 with room to spare. Ignore the AA mark, which judges text. Reload to drop the borrowed declaration.

The palest text on the form is the Phone placeholder, 555 0142, in Chrome’s own gray, #757575, which the Styles pane doesn’t list. Predict whether it passes 4.5:1 inside the white field, then select the Phone <input>, add color: #757575 to its element.style, and click the square.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.