Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-06-11 - Drilldown Navigation Accessibility
**Learning:** Found a Drilldown component (Ramp's Tap-Through Discovery System pattern) that functioned visually but lacked structural accessibility. Custom drilldown/breadcrumb navigation patterns often miss the `aria-current="step"` semantic meaning for screen readers, and dynamic progress counters (like "Level X of Y") need `aria-live="polite"` so screen readers actually announce when the level changes upon clicking 'Next'.
**Action:** When implementing progressive disclosure or drilldown navigation patterns, use `<nav aria-label="Breadcrumb">` for the container, mark the current step with `aria-current="step"`, use `aria-live="polite"` for dynamic level counters, and apply high-contrast focus rings to interactive elements.
19 changes: 10 additions & 9 deletions src/components/drilldown/drilldown-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function DrilldownNavigation({
const current = levels[currentLevel]

return (
<div className={clsx('flex flex-col', className)}>
<nav aria-label="Breadcrumb" className={clsx('flex flex-col', className)}>
{/* Navigation Breadcrumb */}
<div className="flex items-center gap-2 mb-4 text-sm text-neutral-400">
{levels.map((level, idx) => (
Expand All @@ -64,14 +64,15 @@ export function DrilldownNavigation({
setCurrentLevel(idx)
onLevelChange?.(level.id)
}}
aria-current={idx === currentLevel ? 'step' : undefined}
className={clsx(
'hover:text-neutral-200 transition-colors',
'rounded-sm hover:text-neutral-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400',
idx === currentLevel && 'text-neutral-200 font-medium'
)}
>
{level.title}
</button>
{idx < levels.length - 1 && <ChevronRight className="size-4" />}
{idx < levels.length - 1 && <ChevronRight className="size-4" aria-hidden="true" />}
</div>
))}
</div>
Expand All @@ -85,36 +86,36 @@ export function DrilldownNavigation({
onClick={handleBack}
disabled={currentLevel === 0}
className={clsx(
'flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-opacity',
'flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400',
'hover:opacity-80',
currentLevel === 0
? 'opacity-50 cursor-not-allowed text-neutral-500'
: 'text-neutral-300'
)}
>
<ChevronLeft className="size-4" />
<ChevronLeft className="size-4" aria-hidden="true" />
Back
</button>

<div className="text-xs text-neutral-500">
<div aria-live="polite" className="text-xs text-neutral-500">
Level {currentLevel + 1} of {levels.length}
</div>

<button
onClick={handleNext}
disabled={currentLevel === levels.length - 1}
className={clsx(
'flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-opacity',
'flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400',
'hover:opacity-80',
currentLevel === levels.length - 1
? 'opacity-50 cursor-not-allowed text-neutral-500'
: 'text-neutral-300'
)}
>
Next
<ChevronRight className="size-4" />
<ChevronRight className="size-4" aria-hidden="true" />
</button>
</div>
</div>
</nav>
)
}
Loading