[aria-setsize]
Example
<ul role="listbox">
<li role="option">Item 501</li>
<li role="option">Item 502</li>
</ul><ul role="listbox">
<li role="option" aria-setsize="1000" aria-posinset="501">Item 501</li>
<li role="option" aria-setsize="1000" aria-posinset="502">Item 502</li>
</ul>With only part of the list rendered, these attributes give the real position and size.
Common mistakes
- A virtualized list announced as '1 of 20' when it has 10,000 items.
Key points
aria-setsizeis used only when not all items are in the DOM, like virtualized lists or feeds.aria-setsizeis '-1' when the total is unknown, not a guess.- Each item that has
aria-setsizealso has a matchingaria-posinset.
Interview questions
Do I need aria-setsize on a normal list?
No. Browsers count the items when they are all in the DOM, so a plain <ul> already announces the size.
Which roles support aria-setsize?
Items like listitem, option, treeitem, menuitem, tab, radio, article and row in a treegrid.