Put the carousel's tab stop on its items, as M3 asks
Plan step 19, containment.md C-18. The row was the focusable `region` and the items were not focusable at all, which is the thing M3's accessibility page draws a Don't for: "use Tab to place initial focus on the first carousel item", "avoid focusing on the carousel container". Each item is now `tabindex="0"` with the focus ring drawn inside it, the row is out of the tab order, and from a focused item the arrows move one item (moving focus with them), Home and End go to the ends, and Space or Enter opens one that is not fully in view. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
ad37862a9f
commit
9875ba156e
@@ -36,10 +36,12 @@
|
||||
frame, content at full size, so items change size between the keylines. Without script
|
||||
the row still scrolls and snaps, unmasked.
|
||||
|
||||
WAI-ARIA's carousel pattern: the row is a focusable `region` with
|
||||
`aria-roledescription="carousel"`, named by `label` ("Carousel" by default); each item is a
|
||||
`group` with `aria-roledescription="slide"` named "n of m". With the row focused the arrow
|
||||
keys move one item, Home and End to the ends; focus moving into an item, or a press on one
|
||||
The row is a `region` with `aria-roledescription="carousel"`, named by `label` ("Carousel"
|
||||
by default); each item is a focusable `group` with `aria-roledescription="slide"` named
|
||||
"n of m". M3: "Use Tab to place initial focus on the first carousel item" and "avoid
|
||||
focusing on the carousel container", so the items are the tab stops and the row is not one.
|
||||
From a focused item the arrow keys move one item, Home and End go to the ends, and Space or
|
||||
Enter opens an item that is not fully open; focus moving into an item, or a press on one
|
||||
that is not fully open, brings it into focus. `controls` adds previous and next icon
|
||||
buttons under the row — by default only where the pointer is fine (a mouse or trackpad);
|
||||
`true` always, `false` never. Under reduced motion they scroll instantly and nothing is
|
||||
@@ -134,9 +136,8 @@
|
||||
role="region"
|
||||
aria-roledescription="{{ __('carousel') }}"
|
||||
aria-label="{{ $label }}"
|
||||
tabindex="0"
|
||||
@class([
|
||||
'focus-ring flex gap-2 overflow-x-auto overflow-y-hidden overscroll-x-contain',
|
||||
'flex gap-2 overflow-x-auto overflow-y-hidden overscroll-x-contain',
|
||||
'[scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
|
||||
'h-(--material-carousel-height)' => $layout === 'full-screen',
|
||||
'h-[calc(var(--material-carousel-height)+1rem)] py-2' => $layout !== 'full-screen',
|
||||
|
||||
Reference in New Issue
Block a user