[aria-posinset]

Term side of the Card.
Topic: Relationship Attributes
Unit title: [aria-posinset]
Categories: Attribute
Explanation side of the Card

Explanation: The attribute that indicates the position of an item within a set or list. It helps users understand the item's location relative to other items in the set, such as its position in a list.

Example

Wronghtml
<div role="feed">
  <article aria-posinset="0" aria-setsize="-1">First post</article>
</div>
Righthtml
<div role="feed" aria-label="Posts">
  <article aria-posinset="1" aria-setsize="-1">First post</article>
</div>

Positions start at 1, and aria-setsize='-1' means the total is unknown, as in an endless feed.

Common mistakes

  • Using the array index of the rendered slice, so every scroll restarts at position 1.
  • Using 0-based positions, so items are announced off by one.

Key points

  • aria-posinset values are 1-based and reflect the item position in the full set, not in the rendered slice.
  • aria-posinset is paired with aria-setsize on the same items.

Interview questions

Is aria-posinset needed when all items are in the DOM?

No. Browsers calculate position and size for complete lists, so manual values can only add mistakes.

Can aria-posinset be used without aria-setsize?

It can, but set both so screen readers can say 'item 5 of 50' or 'item 5' with an unknown total.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy