ember-data-table icon indicating copy to clipboard operation
ember-data-table copied to clipboard

tr role="button" on table row

Open Wolfr opened this issue 5 years ago • 4 comments

https://github.com/mu-semtech/ember-data-table/blob/ffb1e249eed46b711cd50247b08a2d95adb2da6b/addon/templates/components/data-table-content-body.hbs#L6

It is not helpful to put this ARIA role here.

You are not supposed to add role="button" to a table row, this doesn't help the accessibility. In my understanding of screen readers, the screen reader will now treat the whole row content as a single string and it will not be able to interpret the table correctly.

Wolfr avatar Jan 16 '20 13:01 Wolfr

Hi @Wolfr, thanks for the report.

Is there a way to indicate the full row can be interacted with whilst also letting screen readers understand the content are still table cells?

madnificent avatar May 27 '20 06:05 madnificent

I stumbled upon this because an “accessible table” problem occured again in another project. I noticed I never got to answering this.

My recommendation would be to avoid the problem, by using a visible link to a detail page from an overview grid; and not make whole table rows clickable.

But if you must have clickable rows (for example if a design specifies it, and you can't seem to convince the designer to drop it (hint hint ;) ); then my recommended method would be to:

  • add an action to one of the last table cells, with the link to the detail route
  • This link should be accessible to screen readers but hidden from non-screen-reader users
  • Javascript can be used to grab the link's href which can then be put on the table row with a click event.

Ét voila, we have an accessible table that will be read out correctly.

Wolfr avatar Feb 24 '21 19:02 Wolfr

We should revisit this component so we have cleaner modern EmberJS abstractions. This suggestion seems to be a great solution for efficient operation from both the perspective of highly interactive visual browser agents as well as for screen-readers and the likes.

Thank you for the suggestion. Is this an urgent topic for you?

madnificent avatar Feb 24 '21 20:02 madnificent

Not very urgent, since in our big government project we don't use this pattern at the moment.

However this was on my mind.

Here's a codepen which shows the idea that I talked about, abstracted to as little code as possible.

https://codepen.io/wolfr/pen/rNWdNyX

In this video you can see me navigating using a screen reader.

https://user-images.githubusercontent.com/12690/109391175-1a27f600-7916-11eb-9d2a-025e2518f4fa.mp4

There is a problem that you have to tab twice to get through the list when using a keyboard.

Perhaps this code can help to have a more accessible Ember component.

Wolfr avatar Feb 27 '21 15:02 Wolfr