2

The main issue is that if some cells are NOT clickable and others are, then it will be a poor user experience if user tries to click on the cell and nothing happens.

enter image description hereI need some help in writing labels for screen reader. The issue we have is that not all elements within the table are clickable, so how does this work? How can it be made user friendly if user thinks that one item is clickable and then it's not, unless we create a label for every cell?

4
  • 1
    Hi Claire, it is not that clear what you mean.. could you provide some more details. Visuals helps the community to answer your question a lot. Commented Aug 13, 2021 at 12:57
  • Using the right semantics it shouldn’t be a problem if some elements are clickable or not. You don’t need to add that information to the label. Can you add an image/example of the table and/or the code (if it’s a web app) and give some more explanation what your doubts are or what the problem is?
    – jazZRo
    Commented Aug 14, 2021 at 7:43
  • @jazZRo please see attached image. The main issue is that if some cells are NOT clickable and others are, then it will be a poor user experience if user tries to click on the cell and nothing happens.
    – Claire
    Commented Aug 16, 2021 at 6:50
  • 1
    @RobbyReindeer I have added an image and additional comment
    – Claire
    Commented Aug 16, 2021 at 7:48

2 Answers 2

1

To explain this simply, I think you need to distinguish the elements that are interactive i.e. clickable from the one's that are just plain text. That can be done by giving different colors to clickable vs non-clickable elements, or underlining the clickable one.

As I see in your shared screenshot, all the elements look alike and are blue, ofcourse in this case it will be difficult to distinguish elements and this confusion will impact the UX. Better stick to basic standard in this case, this isn't a big problem and can be sorted out quite easily.

See how in this picture you can easily distinguish elements between the clickable and non-clickable ones. enter image description here

0

If some of the table cells expect input

How this can be done has been documented in the W3C's WAI-ARIA Authoring Practices 1.1, more specifically in the chapter describing the grid role, which you apply to the table element. That chapter has associated examples for data grids.

I suggest that you take a closer look at Example 2: Sortable Data Grid With Editable Cells and its source code. This table contains both editable and non-editable cells. If you navigate the example table, you will see that you can use both the tab keys to move between keyboard-focusable elements and the arrow keys to move between rows and cells (which is different from what you expect in non-interactive tables). In the source code, you will notice that the editable cells contain both a span element and either a button or an input element.

Obviously, the code also relies on JavaScript. Tip: if you go to the data grid examples for the current draft of WAI-ARIA Authoring Practices 1.2, you will find links to code on CodePen, e.g. for the second example, so you can play around with the code on that site.

If the table only contains links

There is no need for labels; ordinary table markup is sufficient and no WAI-ARIA attributes are necessary.

3
  • Please do not use the grid role in this scenario. A grid should only be used if your cells are editable. Similar to a spreadsheet cell. That is, if you can type into a cell. Otherwise, you should use a regular <table>. Clickable elements in a table (whether a link, checkbox, button, etc) do not require the table being a grid. Commented Aug 25, 2021 at 15:51
  • @slugolicious Based on the question whether labels should be added to the cells, I assumed that the table, or at least part of it, was meant to be editable. There is no point in bringing up labels if you don't expect input. If it's just a table of links, normal table markup is sufficient.
    – Tsundoku
    Commented Aug 25, 2021 at 16:21
  • I didn't read that into the OP. It sounded like someone that was not familiar with how screen readers work and wanted more understanding of what happens when you mix interactive elements and static text in the same row. @jazZRo's comment in the OP was probably the closest answer, plus your update to your answer. Semantic html is sufficient in this case. Commented Aug 26, 2021 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.