Shelf
ProOne row of cards that scrolls sideways, with part of the next card showing at its end and Previous and Next at its sides for a mouse. Not an M3 component (@windmorph/react-pro).
import { Shelf, ShelfPlaceholder } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Keyboard
| Key | Action |
|---|---|
| Tab or Shift + Tab | Moves to the next or previous card, which comes wholly into view; after the last card, to Previous and Next. |
| Enter | Follows the focused card's own link. |
| Enter or Space | On Previous or Next: moves the row most of its width; focus stays on the button. |
- When no card takes focus, the row itself is focusable, so the arrow keys scroll it (WCAG 2.1.1).
- There are no arrow keys between cards: Tab moves along the row, and each card keeps its own keys.
Screen reader
- Role
- A
list(aulwithrole="list", which Safari would otherwise drop), each card alistitem. Not a carousel: noaria-roledescription. Previous and Next are buttons. - Accessible name
- The list takes
aria-labeloraria-labelledby(one is required), usually its heading. Previous and Next are named for what they move, from the shelf's name: "Previous: Series", "Next: Series". - States announced
- The arrow at an end is
aria-disabled, kept in place rather than removed ordisabled, so focus on it isn't lost; a press on it does nothing.
- The list reports how many cards it holds, as any list does.
- The arrows are drawn only for a mouse, so screen-reader users on touch move with the screen reader's own gestures and Tab.
Focus
- Tab follows the cards in order, then Previous and Next. A focused card comes wholly into view, its start on the row's snap line, so its focus ring isn't cut at the edge (WCAG 2.4.11).
- The row keeps 4px of room above and below (
--wm-shelf-ring-room), so a card's ring at a 2px offset is drawn whole. - The arrows show the shared two-tone ring over pictures, on keyboard focus only, and show themselves while focus is in the shelf.
Touch target
Previous and Next are 48px. On touch the row scrolls with a swipe and has no arrows; give the shelf a "See all" link for a route without one (WCAG 2.5.7).
Motion
- Previous and Next scroll with the browser's smooth scroll; under reduced motion the row jumps.
- The arrows fade in and out on the default effects spring, kept under reduced motion (a fade isn't movement).
What you need to do
- Name each shelf:
aria-labelledbyits visible heading, oraria-label. - Make each card one link (or one control) with a visible focus ring that fits inside the card's box.
- Add a "See all" link near the heading on touch layouts, so the whole set is reachable without swiping.
- Translate
labels.previousandlabels.next(each given the shelf's name), or set them once for the app with aLabelsProvider. - In forced-colours mode the arrows keep a
CanvasTextboundary; the cards are yours to keep distinct.