Quiz · Hard
Eighteen applied scenarios: contrast and touch-target audits, Core Web Vitals problems, focus and ARIA mistakes, dark mode, form and button design, A/B testing and responsive images.
A page uses 16px body text in #888888 on a white background (contrast about 3.5:1). Which statement is correct?
It passes WCAG AA
It passes AAA
It fails AA for normal-size text; it would only pass AA if the text were large (3:1)
Contrast ratios do not apply to gray text
AA needs 4.5:1 for normal text. #888888 on white is about 3.54:1, so it only meets the 3:1 requirement for large text. Darken the gray (for example #767676 is 4.54:1).
A close button is 20 by 20 CSS pixels with 2px spacing from neighboring controls. Which assessment is correct for WCAG 2.2?
It fails the AA target size minimum of 24 by 24 CSS pixels (unless sufficient spacing offsets it) and is far below the 44px comfort size
It passes everything
It only fails on desktop
Target size is not covered by WCAG
Success criterion 2.5.8 (AA) asks for at least 24 by 24 CSS px, with an exception when undersized targets have enough spacing. 44 by 44 is the AAA recommendation and Apple's guideline.
A late-loading promo banner pushes the article text down while users are reading. Which Core Web Vital is hurt, and what is the fix?
LCP; compress the banner
INP; remove JavaScript
TTFB; use a CDN
CLS; reserve space for the banner (fixed height or aspect ratio) so content does not shift
Cumulative Layout Shift measures unexpected movement of visible content. Reserve space for late content, set width and height on images, and avoid inserting content above what the user is reading.
Your hero image is the Largest Contentful Paint element, but LCP is 4.1 s. You find loading="lazy" on the hero image. What should you do?
Keep lazy loading
Remove lazy loading from the hero image and prioritize it (for example fetchpriority="high" or a preload)
Convert the page to PDF
Delay the image with JavaScript
Lazy loading delays the request for an image that is visible immediately, hurting LCP. Lazy load only below-the-fold images.
Users see blank text for a second while a web font downloads, then the text appears. Which CSS addition addresses this?
display: none;
font-display: swap; in the @font-face rule
font-weight: 900;
text-transform: uppercase;
font-display: swap shows text immediately in a fallback font and swaps when the web font is ready, avoiding invisible text. The side effect is a small layout shift, which can be reduced by matching fallback metrics.
On a 375px-wide phone, the page scrolls horizontally because a table container has width: 600px. What is the most robust fix?
Disable zooming
Set the body to width: 600px
Hide the overflow on the html element
Use max-width: 100% (and let wide tables scroll inside an overflow-x: auto wrapper)
Fixed widths wider than the viewport cause overflow. Use flexible widths and give inherently wide content its own scroll container instead of hiding the problem.
A checkout form shows 12 fields at once and conversion is low. Which design response fits Hick's law and progressive disclosure best?
Split the form into logical steps, show only necessary fields and use sensible defaults
Add more fields so users feel in control
Make all labels italic
Remove the submit button
Fewer simultaneous decisions reduce effort. Break the task into steps, remove optional fields, autofill and group related inputs.
A dark theme uses pure #000000 backgrounds and pure #ffffff text, and users complain about glare and eye strain. What is a better approach?
Increase the font size to 40px
Use bright yellow text
Use dark gray surfaces (such as #121212) with slightly off-white text, then recheck contrast
Use pure black and white but add animation
Maximum contrast (21:1) can cause halation, especially for people with astigmatism. Dark gray surfaces and softened text keep contrast high (about 14:1 for #e0e0e0 on #121212) while reducing glare.
A custom dropdown built from <div> elements works with a mouse but cannot be reached or operated with a keyboard. What does the first rule of ARIA suggest?
Add aria-label everywhere
Add tabindex="-1" to all divs
Hide it from screen readers
Use the native <select> (or other native element) if it meets the need, instead of rebuilding it with ARIA
If native HTML already provides the semantics and keyboard behavior, use it. Custom widgets need roles, states, focus management and key handling (arrow keys, Escape) to be accessible.
A stylesheet contains * { outline: none; } to remove ugly focus rings. What is the problem and the best fix?
No problem; users do not use keyboards
Keyboard users lose track of focus; replace it with a clear :focus-visible style
It breaks images
It makes fonts blurry
WCAG 2.4.7 requires a visible focus indicator. Use :focus-visible to show a strong ring only for keyboard focus, so mouse users are not bothered.
A long-form article spans the full width of a 1440px screen, at about 150 characters per line, and readers lose their place. What should you change?
Increase the letter-spacing
Switch to all capitals
Constrain the text block, for example max-width: 65ch, and use a comfortable line-height
Use a smaller font
Aim for roughly 45 to 75 characters per line. The ch unit (the width of the '0' glyph) makes it easy to cap line length relative to the font.
A form places each label exactly midway between two stacked fields. Users sometimes fill the wrong field. Which principle is being violated, and how do you fix it?
Proximity; place each label closer to its own field than to the neighboring one
Similarity; make labels bold
Closure; add a border
Contrast; use darker text
Elements that are closer together are perceived as related. Keep the label-to-field gap small and the gap between field groups larger.
A product page has Delete and Save buttons side by side, the same size and style, and users keep deleting by accident. What redesign follows from Fitts's law and good UI practice?
Visually distinguish the primary action, separate the destructive action with space (or a confirmation), and avoid placing it where users often click
Make Delete larger
Hide Save
Use a smaller font on both
Targets that are close and similar produce slips. Differentiate by style and distance, ask for confirmation or offer undo for destructive actions.
A team changes the headline, the button color and the hero image all at once in an A/B test, and the variant wins. What is the main weakness?
A/B tests cannot test headlines
Variants must lose
You cannot tell which change caused the improvement; change one variable at a time or use a multivariate design with enough traffic
The test needs fewer users
Bundled changes confound the result. Isolate variables, or use proper multivariate testing, and run until you have enough data.
A product shows status as a red or green dot only. A colleague with red-green color blindness cannot tell them apart. What should you add?
A brighter red
A text label or icon (for example check and cross) in addition to color
More dots
A blinking animation
WCAG 1.4.1 requires that color is not the only way of conveying information. Text, shapes or patterns make status understandable for everyone.
What is the practical benefit of design tokens such as --color-primary and --space-4?
They make images smaller
They replace HTML
They improve SEO ranking directly
One named value is used across design files and code, so a change propagates everywhere and teams stay consistent
Tokens are the single source of truth for design decisions (color, spacing, type, radius) and are usually exposed as CSS custom properties or platform variables.
A phone downloads a 2400px-wide hero image for a 400px-wide slot. Which HTML feature lets the browser choose an appropriately sized file?
alt
autofocus
srcset with sizes
rel="noopener"
srcset supplies several image widths and sizes describes the rendered width, so the browser picks the smallest adequate file. This improves LCP and saves data.
Users on a vestibular-disorder support forum complain about large parallax scrolling effects. Which CSS feature lets you respect their system setting?
@media (prefers-reduced-motion: reduce)
@media (min-width: 1px)
overflow: hidden
font-display: block
prefers-reduced-motion reflects the OS setting. Inside it, remove or simplify large animations, parallax and auto-playing motion.