The HTML aria-posinset attribute
The aria-posinset attribute states an item's position within a set — counting from 1 — when the DOM does not contain every item. Use it with aria-setsize.
Overview
The aria-posinset attribute defines an item's position within a set when not all items are in the DOM.
It describes an element's place in a larger set or hierarchy. This matters when not all items are present in the DOM at once — a virtualized list or a lazy-loaded tree — so assistive technology cannot count them itself. For fully-rendered native lists, the browser computes position and size for you.
Like all ARIA, aria-posinset changes only the accessibility tree — what assistive technology perceives — never the element's behavior or appearance. The first rule of ARIA applies: if a native HTML element or attribute conveys this, use that instead, and only reach for ARIA when nothing native fits.
Syntax
<li role="option" aria-setsize="200" aria-posinset="5"> … </li>
Values
| Value |
|---|
| An integer greater than or equal to 1. |
Example
<li role="treeitem" aria-level="1" aria-setsize="50" aria-posinset="3">Node</li>
Best practices
- Follow the first rule of ARIA — use a native HTML element or attribute that conveys this where one exists, rather than adding ARIA.
- Use these when the full set is not in the DOM (virtualized lists, lazy-loaded trees).
- Set aria-posinset and aria-setsize together for each item.
- For fully-rendered native lists, let the browser compute position and size instead.