WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Using "-1" for table column and row count

for

From: Patrick H. Lauke
Date: Oct 30, 2024 6:04AM


My understanding of this (admittedly not played around with this much):
the "-1" value indicates that the number of rows or columns should not
rely on the user agent's calculation, and should be used when the total
is unknown.

Scenario 1: if you do already know in advance how many there will be
(like your example of there always being 21 news items), then use that
value instead - even if the items aren't fully loaded in the DOM yet and
will only be loaded in dynamically. That way, the table *will* be
announced as having X items, regardless of what is currently in the DOM
or not)

Scenario 2: I would not use any row count attribute here, as the table
will update after user interaction only (and then after it's updated you
can likely rely on the user agent's own calculation of how many rows
there are)

Scenario 3: if you don't know for sure how many total columns there will
be, and they're not all present in the DOM yet, "-1" seems appropriate here.

P
--
Patrick H. Lauke

* https://www.splintered.co.uk/
* https://github.com/patrickhlauke
* https://flickr.com/photos/redux/
* https://mastodon.social/@patrick_h_lauke