0
0
SASSmarkup~20 mins

Accessibility utility generation in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Accessibility Utility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2: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;
}
A
.sr-only {
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  clip: auto !important;
}
B
.sr-only {
  position: relative !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  border: 1px solid !important;
}
C
.sr-only {
  display: none !important;
}
D
.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;
}
Attempts:
2 left
💡 Hint
Think about how screen reader only styles hide content visually but keep it accessible.
🧠 Conceptual
intermediate
1: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?
AUsing @mixin to define reusable style blocks and @include to apply them
BUsing @function to create CSS variables for colors
CUsing @extend to inherit styles from HTML elements
DUsing @import to load external CSS files
Attempts:
2 left
💡 Hint
Think about how to reuse style blocks in multiple places.
selector
advanced
1: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?
A
[aria-hidden="true"] {
  display: none;
}
B
.aria-hidden-true {
  display: none;
}
C
#aria-hidden=true {
  display: none;
}
D
[aria-hidden=true] {
  display: block;
}
Attempts:
2 left
💡 Hint
Attribute selectors use square brackets and quotes for exact matches.
layout
advanced
1: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?
AThe element becomes invisible
BA blue outline around the element with a small gap from the element's border
CThe element's background color changes to blue
DThe element's text becomes bold and underlined
Attempts:
2 left
💡 Hint
Outline and outline-offset control border-like focus rings.
accessibility
expert
2: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?
AMakes content visible only on mouse hover
BAlways hides content from screen readers and keyboard users
CHides content visually but reveals it when the element receives keyboard focus
DRemoves all focus styles from the element
Attempts:
2 left
💡 Hint
Think about how focus styles help keyboard users find hidden content.