Challenge - 5 Problems
Accessibility Utility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
What is the output CSS of this SASS snippet?
Given the following SASS code that generates a utility class for screen reader only content, what is the compiled CSS output?
SASS
@mixin sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .sr-only { @include sr-only; }
Attempts:
2 left
💡 Hint
Think about how screen reader only styles hide content visually but keep it accessible.
✗ Incorrect
The mixin applies styles that visually hide the element but keep it accessible to screen readers. The clip and position absolute with tiny size and negative margin achieve this.
🧠 Conceptual
intermediate1:30remaining
Which SASS feature helps generate multiple accessibility utilities efficiently?
You want to create several utility classes for accessibility (like .sr-only, .focus-visible, .aria-hidden) using SASS. Which feature helps you write less code and generate these classes dynamically?
Attempts:
2 left
💡 Hint
Think about how to reuse style blocks in multiple places.
✗ Incorrect
Mixins allow you to define reusable style blocks that can be included in multiple classes, perfect for generating accessibility utilities.
❓ selector
advanced1:30remaining
Which selector correctly targets elements with aria-hidden="true" in SASS?
You want to write a SASS rule that styles all elements with the attribute aria-hidden set to true. Which selector syntax is correct?
Attempts:
2 left
💡 Hint
Attribute selectors use square brackets and quotes for exact matches.
✗ Incorrect
The correct CSS attribute selector syntax uses square brackets with the attribute name and value in quotes. Option A matches elements with aria-hidden="true".
❓ layout
advanced1:30remaining
What visual effect does this accessibility utility produce?
Consider this SASS utility class for keyboard focus visibility:
.focus-visible {
outline: 2px solid #005fcc;
outline-offset: 2px;
}
What will a user see when an element has this class?
Attempts:
2 left
💡 Hint
Outline and outline-offset control border-like focus rings.
✗ Incorrect
The outline property draws a visible border around the element, and outline-offset creates space between the border and the element's edge, making the focus ring clear and accessible.
❓ accessibility
expert2:30remaining
What is the effect of this SASS snippet on screen reader users?
This SASS code creates a utility class:
.visually-hidden-focusable {
@include sr-only;
&:focus, &:active {
position: static !important;
width: auto !important;
height: auto !important;
margin: 0 !important;
overflow: visible !important;
clip: auto !important;
white-space: normal !important;
}
}
What does this utility do for users navigating with keyboard and screen readers?
Attempts:
2 left
💡 Hint
Think about how focus styles help keyboard users find hidden content.
✗ Incorrect
This utility hides content visually by default but makes it visible and accessible when focused or active, helping keyboard users access important information that is otherwise hidden.