0

I'm working with a data table constructed from DIVs and styled as a CSS grid (not my idea! and I've been asked to leave it that way, so please just accept that as an immutable condition). My task is to make it accessible and, for now, I'm testing with ANDI in Chrome on Windows. It's an Angular application with Bootstrap, if that makes a difference.

(UPDATE at another's request: ANDI is a detailed web accessibility analytical tool published by the US Social Security Administration at https://www.ssa.gov/accessibility/andi/help/install.html. It's a favelet, you just save a bookmark to it and then click the bookmark when you have a page up in your browser.)

When I open the page in the browser and turn on ANDI, it finds the table, with its 13 columns and 100 data rows in addition to the header row, but it flags two errors:

  • "ARIA table has no [role=row] rows."
  • "<table[role=table]> has 1313 cells not contained by [role=row]."

And, indeed, while ANDI marks the table with a dashed border, it doesn't mark the cells, nor does it respond to my hovering the cursor over them.

There's an Angular component element, the data row component, <app-content-row>, in the middle of this. I wondered whether that could be source of the problem, but I tried removing it, leaving only the row with the column headers, and ANDI gave me the same report.

I can't provide the full code for proprietary reasons, and for clarity I'm going to leave out the directive (_ngcontent-wjw-c154, in this instance) that Angular inserts into every element, but looking at it in the Chrome inspector window, it starts, basically, with:

<div role="table" class="..." ...>
  <div role="rowgroup" style="display: contents;">
    <div role="row" ...>
      <div role="columnheader" ...>ID</div>
      <div role="columnheader" ...>Name</div>
      <div role="columnheader" ...>Start Date</div>
      <!-- More columnheaders -->
    </div>
  </div>
  <div role="rowgroup style="display:contents;">
    <app-content-row ...>
      <div role="row" ...>
        <div role="rowheader" ...>137</div>
        <div role="rowheader" ...>Frapjab Industries</div>
        <div role="cell" ...>04/15/2008</div>
        <!-- More cells -->
      </div>
      <!-- More rows -->
    </app-content-row>
  </div>
</div>

Above is my second attempt. In my first attempt, I didn't even have the role="rowgroup" divs wrapped around the header row and around the data rows, and I guessed that maybe they, unlike thead and tbody in an HTML table, were required. In my third attempt, guessing that maybe the role="row" divs had to be directly inside the role="rowgroup" element, I removed the second "rowgroup" div and instead stuck role="rowgroup" into the <app-content-row> tag. That role did carry through to the code displayed in the Chrome inspector. But it made no difference in the ANDI outcome.

My fourth attempt, removing the data rows (including the Angular component tags they're wrapped in, leaving only the column header row:

<div role="table" class="..." ...>
  <div role="rowgroup" style="display: contents;">
    <div role="row" ...>
      <div role="columnheader" ...>ID</div>
      <div role="columnheader" ...>Name</div>
      <div role="columnheader" ...>Start Date</div>
      <!-- More columnheaders -->
    </div>
  </div>
</div>

Still no good. So the Angular component tags had nothing to do with it.

Are there any common causes of ANDI failing to find the table structure defined by the roles, or unable to see the defined roles? Is there anything it seems I've missed?

Green Grasso Holm
  • 468
  • 1
  • 4
  • 18
  • 2
    Sounds like a bug in ANDI. Try WAVE by WebAIM and Axe by Deque and see if they flag the table. – slugolicious Dec 13 '22 at 08:45
  • 1
    I don’t know ANDI. Would you mind adding a source to your question? – Andy Dec 13 '22 at 13:38
  • @Andy, certainly, I've added a reference to it above. – Green Grasso Holm Dec 13 '22 at 13:57
  • @slugolicious, I'm thinking you're right. I can't install extensions without going through a bureaucracy (ANDI is a favelet, so no organizational authorization required), but I do have NVDA installed, I realized, and I went ahead and tried that. NVDA recognizes the table just fine, reading row and column headings as I navigate through the table. If an actual, major screen reader is happy with my table, then I'm guessing a bug in ANDI was the source of the problem. – Green Grasso Holm Dec 13 '22 at 13:59
  • There’s also Lighthouse that you could use in Chrome without installing anything. I just noticed the `display: contents` and remembered that there was some article warning of a11y implications of that property. Maybe related? https://adrianroselli.com/2018/05/display-contents-is-not-a-css-reset.html#A11y – Andy Dec 13 '22 at 15:07
  • @GreenGrassoHolm While using a screen reader and having it successfully navigate through a table and properly announce row/col headers as you navigate to each cell is a huge testament that the table is most likely correct, sometimes there are screen readers that use heuristics and try to "guess" at what your code is trying to do and might overcome some coding errors. NVDA typically does **not** (never?) use heuristics so if it works there, you're probably good. JAWS can sometimes be forgiving with bad code. And as @andy said, I would **not** use any CSS `content` property on table parts. – slugolicious Dec 13 '22 at 18:03
  • If a data table is being created from a CSS grid, and you want to group rows, I don't see that you have a choice about display:contents, do you? Without it, you don't have a rows-and-columns grid--you don't want the rowgroups, the immediate children of the role="table" div, to be the rows, and you don't want the rows to be the grid's cells. So if I have to accommodate that bug, I'd have to get rid of the rowgroup level--which actually doesn't bother me in this case. – Green Grasso Holm Dec 13 '22 at 20:29
  • Besides, I'm understanding from the latter part of that article, and other documentation I'm seeing online, that accessibility bug was remedied quite some time ago--and, yet, I'm now trying to use NVDA on this page in Firefox and it doesn't recognize any structure inside the table. (Though it does work in Edge as well as Chrome. My users don't have Safari--this is an internal application.) So I guess I have work to do anyway. – Green Grasso Holm Dec 13 '22 at 20:29

0 Answers0