Course contentsShow
← Web Development
Lesson 1194 of 2,98221. Accessible ComponentsFree lesson

Previous/Next Button Labeling

Provide descriptive aria-labels for navigation buttons beyond generic 'next' and 'previous' text.

Previous/Next Button Labeling

You'll learn how to make carousel navigation buttons understandable by providing context beyond just "next" and "previous."

The Problem with Generic Labels

When you label carousel buttons with only "Next" or "Previous," screen reader users hear these words out of context. They don't know what they're navigating through. Is it product images? Testimonials? News articles? It's like someone shouting "Go forward!" without telling you where you're going.

Adding Descriptive Context

Use the aria-label attribute to make your navigation buttons informative and specific. Instead of generic text, describe what content the button navigates:

<!-- ❌ Generic - lacks context -->
<button>Previous</button>
<button>Next</button>

<!-- ✅ Descriptive - provides full context -->
<button aria-label="Previous testimonial">
  <span aria-hidden="true">‹</span>
</button>
<button aria-label="Next testimonial">
  <span aria-hidden="true">›</span>
</button>

The icon itself (‹ or ›) is hidden from screen readers with aria-hidden="true", while the aria-label provides the complete, descriptive label.

More Examples

The context should match your carousel content:

<!-- For product gallery -->
<button aria-label="Previous product image">‹</button>

<!-- For news items -->
<button aria-label="Next news article">›</button>

<!-- For featured posts -->
<button aria-label="Previous featured post">‹</button>

The Analogy

Think of it like elevator buttons. Generic labels are like buttons that only say "Up" and "Down" — functional, but minimal. Descriptive labels are like "Up to Menswear, Floor 3" — they tell you exactly where you're headed and what you'll find there.

Key Takeaway: Always provide descriptive aria-label attributes on carousel navigation buttons that specify what content users are navigating through, not just the direction of movement.