-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish resolving accessibility issues with Table Block #24205
Comments
Hi all, I just wanted to chime in on this issue to add some background and hopefully clarity. There have been a few attempts to make accessible tables in gutenberg and I appreciate the effort. I think the reason this hasn't landed quite right is because the nature of this can be confusing. There are a few details required to make a table accessible
Here is an example table. It's in markdown and there are limitations there, so I will not say this is fully accessible.
If this were accessible it would have a Instead, the first cell of each row in So the expected HTML would be
There are a lot more complexities with tables. It should be possible to merge cells, build inner tables, set scope to colgroup and rowgroup, define IDs for each cell and row, then set aria-label and aria-labeledby in order to make complex tables, but I think at this point the goal should be to make flat tables fully accessible and let people use an HTML block for complex tables as they really need a lot of special consideration to make them correctly accessible. I hope seeing the completed HTML and hearing the reasoning behind this request makes it more clear. I'm also willing to work on a PR for these changes.
|
Just to provide some feedback, as I've worked a bit on the table block in the past, and it's important that in the process of addressing these points other regressions aren't introduced.
@joedolson The next part is that to solve a separate accessibility issue, the Happy to see a
@NicktheGeek This would be great. I think the challenge here is that most users consider this block like a spreadsheet, and don't understand these semantics and won't know what a 'scope' is or why it's important. The worst result would be that this feature is misunderstood by users and so not used. The best result is that adding row headers feels like a natural part of building a table and the scope is added as a transparent part of that process. |
@talldan thanks for the feedback.
I agree most users don't understand this. Most users don't understand they need to add clear and meaningful alt tags. They either don't add them, or say something like "image of a red apple." Worse they think that's the place to put all their keywords. One of the reasons I ended up finding this issue and previous issues was a direct result of a series I'm writing on building accessible content. I wrote up the section on tables then a colleague reviewed it. He said that I wasn't focused too much on theory and needed to give usage examples like other sections. He was right so I created an example form, which I used in my comment, and tried to build this correctly in the block editor and realized it isn't possible. If people don't know what to do, we solve it by educating them. That's what my series is all about, teaching people how to make accessible content. If people can't do it right, we fix the tools. If the worst case is that users don't know what to do and leave the current functionality, then there is no negative in providing this. The real worst case is that they just randomly mark cells as headers and really mess up their markup/accessibility. We solve that with education too. There are so many tools that people can misuse and abuse in ignorance. They exist for people to do it right, but that won't stop people from doing it wrong. I've got 2 chain saws and I fell trees that have died/are dying in the fall then cut them up so I can split them and stack the wood to dry for burning the following season. Chainsaws can be misused and the consequence can be life threatening. I wear lots of safety gear but the most important thing to keep me from the ER is education. I like that the heading and scope get set automatically for the I like the suggestion that during the We just need a simple, and intuitive way to control cell heading and scope via the editor so that users who do know what they are doing have more control to do it right while retaining the current process of assigning it automatically to the heading row and ensuring that the front end output doesn't contain empty I think this is something we can do. |
So, another thing to observe about the table captions: it should be different depending on whether the table is a data table or a presentational table. A data table is expected to have a I can see the argument about the positioning of the caption, and having the editable region match the visible position or having the tab order not match the visual order. However, for identifying accessible data tables, the caption element is very much the right choice, so this might require some kind of compromise. I think we should prioritize the user experience for visitors to the site over administrators, however, as that is the broader reach for almost all sites. Using In order to give the site visitor the best experience, using a Note: for screen readers, the caption is read first regardless of which side it's visually displayed on, so at least for screen reader users in the editor, at least in some ways, the read order & the edit order will match. For screen readers, the caption is more equivalent to a label for a form field or the aria-label to a landmark region, and is used to identify the table. When doing a line-by-line reading, the caption will appear at the end of the table if it is positioned with Also note that testing with Voiceover should be considered the exception, and not the rule; Voiceover is the most unusual screen reader, and in general the goal should be to ensure function in Windows screen readers, then try and work out why Voiceover is doing something differently. Obviously there can be exceptions to this. |
I played around with a custom accessible block table that addressed these issues very simply: https://github.com/stmarytx/cgb-a11y-table/tree/master Using the toggle adds the necessary scope to the column or row. Here are my thoughts working in the real world with content editors, they do want to make accessible tables but it should be simpler to do. Most use cases just need a table with header cells in the top row only Many forgot to enable the header section and wonder why their headings are not bolded or styled like other tables which do use a header section with th. By default 'header section' should be toggled true. I'm not aware of any content editor that is using the table for presentation but if someone decides to turn headers off then the table can be automatically labelled as presentation. The scope should added automatically when adding header or row section even if its a easy to understand table since it does no harm. Also when inserting a table a mini wizard can be presented that shows various layouts that can be selected, this would help users achieve accessibility as well:
As for more complicated tables, I discourage them and either find ways where you can break the complicated table down into smaller and simple tables or find a alternative ways of presenting the data. |
This is an older issue, but came in to echo @joedolson's point that a I wonder if this has been explored: a caption field in the block settings that doesn't display in the editor, but does show up as a |
@richtabor wanted to bring your attention to this current issue as I see you're working on some recent designs to improve aspects of the table block right now: #49275 I wonder if there are ways to incorporate the concerns here into what might be worked on. |
Is the simplest solution to render the existing |
That's part of the solution; it also needs to be conditional: the caption should only be available when table headers are present, either row or column headers, so that those semantics aren't added on tables that are only presentational. |
Is your feature request related to a problem? Please describe.
Problem: Cannot create a table with row header cells; can create a table with empty header cells; tables not differentiated between presentational and data; captions use the wrong semantics.
Issues:
See also #15283 for prior work towards making the table block accessible.
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: