Examples

ARIA examples

Live grids with list, listbox, busy and keyboard patterns, and four ways to test them.

Each grid on this page holds 10,000 items and shows one of the ARIA patterns from the accessibility guide. Each demo's source link opens its component.

List with item positions

The grid has role="list", and each item has role="listitem", aria-setsize and aria-posinset.

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
Item 21
Item 22
Item 23
Item 24
Item 25
Item 26
Item 27
Item 28
Item 29
Item 30
Item 31
Item 32
Item 33
Item 34
Item 35
Item 36
Item 37
Item 38
Item 39
Item 40
Item 41
Item 42
Item 43
Item 44
Item 45
Item 46
Item 47
Item 48
Item 49
Item 50
Item 51
Item 52
Item 53
Item 54
Item 55
Item 56
Item 57
Item 58
Item 59
Item 60

Check it:

  1. Scroll to the middle of the list, then move the screen reader cursor onto an item. The announced position matches the item's number, for example 4,200 of 10,000.
  2. Scroll the grid and select an item again. The announced position follows the item, not its place among the rendered elements.

Build it with Add list roles and Set the size and position of each item.

Source: AriaListDemo.vue

Listbox with a selected option

The grid has role="listbox" and an aria-label, and each item is an option with aria-selected.

Option 1
Option 2
Option 3
Option 4
Option 5
Option 6
Option 7
Option 8
Option 9
Option 10
Option 11
Option 12
Option 13
Option 14
Option 15
Option 16
Option 17
Option 18
Option 19
Option 20
Option 21
Option 22
Option 23
Option 24
Option 25
Option 26
Option 27
Option 28
Option 29
Option 30
Option 31
Option 32
Option 33
Option 34
Option 35
Option 36
Option 37
Option 38
Option 39
Option 40
Option 41
Option 42
Option 43
Option 44
Option 45
Option 46
Option 47
Option 48
Option 49
Option 50
Option 51
Option 52
Option 53
Option 54
Option 55
Option 56
Option 57
Option 58
Option 59
Option 60

Check it:

  1. Click an option. Its ring appears, and its aria-selected changes to true in the Elements panel of the browser's developer tools.
  2. With a screen reader running, move its cursor onto the option and listen for "selected".
This demo selects with the mouse only. Clicking an option does not move focus, so a keyboard user cannot select one here. To make options focusable, use the pattern from Keyboard navigation.

Build it with the listbox and option roles.

Source: AriaListboxDemo.vue

Busy placeholders

The page provider takes 1.5 seconds, so scrolling shows placeholders. Each placeholder has aria-busy="true" and keeps its position in the set.

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
Item 21
Item 22
Item 23
Item 24
Item 25
Item 26
Item 27
Item 28
Item 29
Item 30
Item 31
Item 32
Item 33
Item 34
Item 35
Item 36
Item 37
Item 38
Item 39
Item 40
Item 41
Item 42
Item 43
Item 44
Item 45
Item 46
Item 47
Item 48
Item 49
Item 50
Item 51
Item 52
Item 53
Item 54
Item 55
Item 56
Item 57
Item 58
Item 59
Item 60

Check it:

  1. Scroll the grid. Gray placeholders appear before the items load.
  2. Right-click a placeholder before it loads and choose Inspect. The Elements panel shows aria-busy="true" on the element, with the same aria-posinset the loaded item gets.
  3. Wait 1.5 seconds. The grid replaces the placeholder with the item, which has no aria-busy.
Screen readers differ in what they do with aria-busy on a list item. Some say "busy" and some say nothing, so move the screen reader cursor onto a placeholder and note what yours says.

Build it with Mark placeholders as busy.

Source: AriaBusyDemo.vue

Keyboard navigation

Press Tab to enter the grid, then use the arrow keys. The focus ring follows the focused item. The grid scrolls only when the item would leave the view, and only far enough to show it.

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
Item 9
Item 10
Item 11
Item 12
Item 13
Item 14
Item 15
Item 16
Item 17
Item 18
Item 19
Item 20
Item 21
Item 22
Item 23
Item 24
Item 25
Item 26
Item 27
Item 28
Item 29
Item 30
Item 31
Item 32
Item 33
Item 34
Item 35
Item 36
Item 37
Item 38
Item 39
Item 40
Item 41
Item 42
Item 43
Item 44
Item 45
Item 46
Item 47
Item 48
Item 49
Item 50
Item 51
Item 52
Item 53
Item 54
Item 55
Item 56
Item 57
Item 58
Item 59
Item 60

Check it:

  1. Press Tab until the focus reaches the grid. The first item has a focus ring.
  2. Press the arrow keys. The focus moves one item or one row in that direction.
  3. Hold the down arrow with a screen reader running. The grid scrolls, and the announced position keeps climbing.

Build it with Keep the focused index in a ref, Scroll to the new item and focus it, and Listen for arrow keys on the grid.

Source: AriaKeyboardDemo.vue

Test it

A screen reader announces facts that hold for every item: its role, its name and its position, for example 4,200 of 10,000. The exact wording and the order vary by screen reader and browser, so check the facts and not a fixed sentence.

macOS VoiceOver

  1. Press Cmd + F5 to start VoiceOver.
  2. Move through the page with the VO keys (Ctrl + Option) and the arrow keys.
  3. Press VO + U to open the rotor and list the page's lists and items.

Windows NVDA

NVDA is a screen reader for Windows that costs nothing to download and use.

  1. Install NVDA and start it.
  2. Press Insert + F7 to open the elements list.
  3. Close it, then use the arrow keys in browse mode to move through the items.

Without a screen reader

  • Chrome: open DevTools, then Elements, then the Accessibility pane. Select an item to see its computed role, name and position in set.
  • Firefox: open DevTools and use the Accessibility inspector to see the same properties.

Scroll the grid and select an item again. The position in set must match the item's number, not its place among the rendered elements.

Automated

The axe DevTools extension and @axe-core/playwright report missing or invalid roles. A Playwright test can also scroll the grid and read aria-posinset from the items that are rendered after the scroll:

import { test, expect } from "@playwright/test";

test("items keep their position after scrolling", async ({ page }) => {
  await page.goto("/examples/aria");
  const grid = page.locator('[role="list"]').first();
  await grid.evaluate((el) => {
    el.parentElement!.scrollTop = 20000;
  });

  const item = grid.locator("[aria-posinset]").first();
  await expect(item).toHaveAttribute("aria-setsize", "10000");
  const position = Number(await item.getAttribute("aria-posinset"));
  expect(position).toBeGreaterThan(100);
});
Copyright © 2026