Media grid
ProSquare photo tiles, a sideways row on compact windows and a grid from medium up; a press on a tile reports it (`onAction`), for the app to open the viewer. Not an M3 component (@windmorph/react-pro).
import { MediaGrid } 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 | Where |
|---|---|---|
| Tab | Moves focus to the list while it scrolls (the compact row), then to each tile in turn. Every tile is its own Tab stop. | |
| Arrow Left or Arrow Right | Scrolls the compact row sideways while the list has focus.On the list | On the list |
| Enter or Space | Presses the tile: onAction gets its index and the tile, usually to open MediaViewer there, growing out of the tile (origin).On a tile | On a tile |
Screen reader
- Role
- A
list(ul) of list items, each holding abutton. - Accessible name
- The list is named by its required
aria-label("Photos"); each tile by its photo'salt. - States announced
- None. Screen readers read the number of items from the list.
- Only the first
maxphotos are rendered, so the count is of the tiles shown. - A tile whose photo can't be loaded is still a button named by its
alt, and still callsonAction. Its placeholder icon is hidden from assistive tech, and the failure is not announced on the tile.
Focus
- While the compact row scrolls, the list itself is focusable (
tabIndex={0}), so a keyboard can scroll it (WCAG 2.1.1). From medium windows up, where the grid does not scroll, it is not a Tab stop. - Each tile shows M3's focus indicator inside its edge on keyboard focus (a 3px
secondaryoutline drawn inset), so the row never clips it. Pointer presses show no ring.
Touch target
In the compact row each tile is 112 × 112px (tile-width). From medium windows up a tile is a square of the grid's width divided by columns (3 by default), less the 4px gaps.
Motion
Each tile shows the core's state layer over its photo (hover, focus) and the press ripple. Under reduced motion the ripple appears at full size without growing.
What you need to do
- Name the list with
aria-label, and give every photo analtthat says what it shows: it is the tile's only name. - Open something useful from
onAction, such asMediaVieweron that photo, so pressing a tile always does something. - When
maxhides photos, offer a way to reach the rest, such as a "See all photos" link. - A failed photo's tile still calls
onAction: open something that says the photo can't be shown, asMediaViewerdoes, or offer another try.