Bird
Raised Fist0
Bootsrapmarkup~10 mins

Why accessibility is a requirement in Bootsrap - Test Your Understanding

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add an accessible label to the button using Bootstrap.

Bootsrap
<button type="button" class="btn btn-primary" aria-[1]="Submit form">Submit</button>
Drag options to blanks, or click blank then click option'
Alabel
Bhidden
Clabelledby
Ddescribedby
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'aria-labelledby' which requires an ID reference to an existing label.
Using 'aria-hidden' which hides the element from assistive technologies.
2fill in blank
medium

Complete the code to make the image accessible by adding alternative text.

Bootsrap
<img src="logo.png" class="img-fluid" alt="[1]">
Drag options to blanks, or click blank then click option'
Alogo
B"
Cimage
DCompany logo
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving alt text empty when the image conveys important information.
Using vague alt text like 'image' or 'logo' without context.
3fill in blank
hard

Fix the error in the code to ensure the form input is accessible with a proper label.

Bootsrap
<label for="emailInput">Email address</label>
<input type="email" class="form-control" id="[1]" placeholder="Enter email">
Drag options to blanks, or click blank then click option'
Aemailinput
BemailInput
Cemail_address
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching the input id and label 'for' attribute.
Using different casing or underscores that don't match.
4fill in blank
hard

Fill both blanks to create an accessible navigation bar with proper roles and labels.

Bootsrap
<nav class="navbar navbar-expand-lg navbar-light bg-light" role="[1]" aria-[2]="Main navigation">
  <!-- Navbar content -->
</nav>
Drag options to blanks, or click blank then click option'
Anavigation
Bbanner
Clabelledby
Dlabel
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect roles like 'banner' for navigation.
Confusing 'aria-label' with 'aria-labelledby'.
5fill in blank
hard

Fill all three blanks to create an accessible modal dialog with proper ARIA attributes.

Bootsrap
<div class="modal" tabindex="-1" role="[1]" aria-[2]="modalTitle" aria-[3]="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <h5 class="modal-title" id="modalTitle">Modal title</h5>
      <!-- Modal body -->
    </div>
  </div>
</div>
Drag options to blanks, or click blank then click option'
Adialog
Blabelledby
Cmodal
Dhidden
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect roles like 'modal' which is not a valid ARIA role.
Confusing 'aria-hidden' with 'aria-label' or 'aria-labelledby'.

Practice

(1/5)
1. Why is accessibility a requirement when using Bootstrap for web development?
easy
A. It ensures all users, including those with disabilities, can use the website.
B. It makes the website load faster on all devices.
C. It guarantees the website looks the same in all browsers.
D. It automatically fixes all coding errors.

Solution

  1. Step 1: Understand the purpose of accessibility

    Accessibility means making websites usable for everyone, including people with disabilities.
  2. Step 2: Connect accessibility with Bootstrap usage

    Bootstrap provides tools but accessibility ensures all users can interact with the site properly.
  3. Final Answer:

    It ensures all users, including those with disabilities, can use the website. -> Option A
  4. Quick Check:

    Accessibility = Inclusive use [OK]
Hint: Accessibility means everyone can use your site, not just some [OK]
Common Mistakes:
  • Confusing accessibility with speed or design consistency
  • Thinking Bootstrap fixes all errors automatically
  • Believing accessibility is optional
2. Which Bootstrap feature helps improve accessibility by providing semantic meaning to components?
easy
A. Using aria-label attributes on buttons and links
B. Adding float classes for layout
C. Using text-center to align text
D. Applying bg-primary for background color

Solution

  1. Step 1: Identify accessibility attributes in Bootstrap

    ARIA labels like aria-label provide screen readers with descriptions.
  2. Step 2: Differentiate from styling classes

    Classes like float, text-center, and bg-primary affect layout and style, not accessibility.
  3. Final Answer:

    Using aria-label attributes on buttons and links -> Option A
  4. Quick Check:

    ARIA labels = Accessibility [OK]
Hint: ARIA labels add meaning beyond style, boosting accessibility [OK]
Common Mistakes:
  • Confusing style classes with accessibility features
  • Ignoring ARIA attributes
  • Assuming color classes improve accessibility
3. What will a screen reader announce for this Bootstrap button?
<button class="btn btn-primary" aria-label="Close"><span aria-hidden="true">&times;</span></button>
medium
A. Button
B. Times symbol
C. Close
D. No announcement

Solution

  1. Step 1: Understand the role of aria-label

    The aria-label="Close" tells screen readers to announce "Close" for this button.
  2. Step 2: Recognize aria-hidden effect

    The aria-hidden="true" on the span hides the times symbol from screen readers.
  3. Final Answer:

    Close -> Option C
  4. Quick Check:

    ARIA label overrides hidden content [OK]
Hint: ARIA label text is what screen readers say, not hidden symbols [OK]
Common Mistakes:
  • Thinking the times symbol is read aloud
  • Ignoring aria-hidden attribute
  • Assuming no label means no announcement
4. Identify the accessibility error in this Bootstrap form snippet:
<input type="text" class="form-control" placeholder="Enter name">
medium
A. Input type should be email
B. Using form-control class incorrectly
C. Placeholder text is too long
D. Missing aria-label or label for screen readers

Solution

  1. Step 1: Check for accessible labels

    The input lacks a visible <label> or an aria-label, so screen readers can't identify it properly.
  2. Step 2: Understand placeholder limitations

    Placeholder text is not a substitute for labels because it disappears when typing and is not always read by screen readers.
  3. Final Answer:

    Missing aria-label or label for screen readers -> Option D
  4. Quick Check:

    Labels are essential for accessibility [OK]
Hint: Always add labels or aria-labels, placeholders aren't enough [OK]
Common Mistakes:
  • Thinking placeholder replaces label
  • Confusing class usage with accessibility
  • Assuming input type affects accessibility here
5. You want to make a Bootstrap modal accessible. Which combination is best to ensure screen readers announce the modal correctly?
hard
A. Use only tabindex="-1" on the modal container
B. Add aria-labelledby pointing to the modal title and aria-hidden="true" when hidden
C. Add role="button" to the modal container
D. Rely on Bootstrap classes without ARIA attributes

Solution

  1. Step 1: Use aria-labelledby for modal title

    This attribute links the modal to its title so screen readers announce the correct heading.
  2. Step 2: Manage visibility with aria-hidden

    Setting aria-hidden="true" when the modal is hidden prevents screen readers from reading it.
  3. Step 3: Avoid incorrect roles and incomplete attributes

    role="button" is wrong for modals; relying only on classes misses accessibility needs.
  4. Final Answer:

    Add aria-labelledby pointing to the modal title and aria-hidden="true" when hidden -> Option B
  5. Quick Check:

    ARIA labels + visibility = Accessible modal [OK]
Hint: Use ARIA labels and hidden states for accessible modals [OK]
Common Mistakes:
  • Using wrong ARIA roles
  • Ignoring hidden state for screen readers
  • Assuming Bootstrap classes handle all accessibility
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard