-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
CKEditor 5 Mangles Table Structure and Makes Tables Inaccessible / Support for Tables with Multi-Level Headers / Allow <tbody> <th> in any column #14911
Comments
Thank you for the report, we will analyze it. One comment, data change is not data loss, as far as I can see, we don't have in the examples the data loss where the data vanishes. We need to standardize the incoming HTML to a common format to make some features work, like |
Thanks for the response, Witek. My main reason for mentioning data loss is that this bug seems to merge multiple tbody tags into a single tbody tag. Depending on the source code of the original table, it may be impossible to determine the original number and/or location of those tbody tags. And if the table has one or more th tags whose scope attribute equals rowgroup, then the tbody tags convey semantic information about the table to users of screen readers. So, the bug may erase semantic data about a table that is necessary for screen reader users to properly interpret the table. For example, given the following table, the loss of the second tbody tag prevents you from determining how many of the final rows were in the first tbody tag (or even if there was a second tbody tag). And the loss of the second tbody tag changes the meaning of the table for screen reader users.
|
Tracking this on |
We have a client with over 1000 complex data tables that would all suffer what I would consider data loss as a result of this bug(s) / lack of full support for HTML tables. To borrow the quote on the related Drupal.org issue from @phil-s
There are a couple different issues detailed here, while investigating I wanted to explore a potential avenue specifically for the issue of I've added a draft PR with a PoC - the idea is to introduce a I've added a manual test with the markup from the table 3 example - while it gives me the expected output for Its draft (no doc changes or automated tests at this stage) but I'm very keen to get feedback on the approach before I go further as I'm not experienced with the CKEditor 5 framework / ecosystem so there's probably more elegant approaches. For As it stands this issue is a blocker for use to adopt CKEditor5 so keen to help find solutions where we can. Side note - your contribution docs are awesome - thank you for those! |
@niegowski could you take a look when you have time? |
I'd just like to add that while the examples provided are about CKEditor mishandling existing markup, it seems to me the CKEditor doesn't even create its own tables with the basic markup required for accessibility. For example, if a table has two headers in two different directions, like a header row as well as a header column, accessibility guidelines require the "scope" attribute in order to properly determine the direction of the headers, but CKEditor does not do this: https://www.w3.org/WAI/tutorials/tables/two-headers |
The table bugs here are really critical. I’m responding to an RFP for a city government website proposal, and one question completely disqualifies Drupal 10 with CKE5 as inconformant:
If you copy/paste the table example from Curriculum for Web Content Accessibility Guidelines 1.0 (created in year 2000!) into the CKEditor 5 demo page (via the Source mode button) it is broken. It appears that several things are happening:
![]() ![]() |
Regarding this one in the previous comment:
It is worth clarifying that this has not been called out as a distinct issue from the "rowgroup" bug mentioned in the issue summary above. They're related for sure, but this issue where rows from table body get pulled up to |
I'm late to this conversation, but wanted to chime in that we have a vendor who recently upgraded to CKEditor 5, and this has mangled all our tables as well. On a separate note, I wish CKEditor 5 wouldn't wrap the table in an auto-padded element, since this prevents us from setting our tables to 100% width.
Data change can absolutely be data loss. If someone shuffled all the primary IDs in your SQL table, would you not consider that data loss? |
I'm gonna remember this quote! 😄 |
🍎 👉 🍊 😊
Just to make sure, you mean: .ck-content .table {
margin: 0.9em auto;
display: table;
} AFAIK, this could be easily configurable via changing CSS, and |
JFYI, on the |
Thanks for the reply! This is related to a vendor's implementation, so I'll pass this along. I had found and suggested editing that style before, but the link is very helpful. 😊 Might I ask one more related question (and then I promise to stop hijacking)? In the vendor's implementation, the table selection handle still appears when the editor element is in read-only mode. It appears when the page first loads, then disappears if you select the table and unselect it. Is that working as intended? The selection handle is useful in edit mode, but not in read-only mode. |
There's a separate issue (opened in 2018!) about this: #3175 |
📝 Provide detailed reproduction steps (if any)
Table 1
This table has a rowgroup header with a colspan.
Table 2
This table has two rowgroup headers that have colspans.
Table 3
Similar to previous examples, but we've removed the colspan on the rowgroup and replaced with empty td elements. We've also added some row headers to the second column and a tbody block that doesn't have any th with a scope set to rowgroup.
Table 4
This table is an example from the HTML spec.
✔️ Expected result
CKEditor does not alter the table markup.
❌ Actual result
Table 1
CKEditor has moved the parent row for "Rowgroup Header 1" into the thead element, which makes the table inaccessible to screen readers.
Table 2
CKEditor has moved all the parent rows for rowgroup headers into the thead element. It has also put all the rows after the thead block into one tbody block. This makes the table inaccessible to screen readers and is a loss of data, since we can no longer reconstruct the original table due to loss of the tbody blocks.
Table 3
CKEditor has not moved all the parent rows for rowgroup headers into the thead element, but has put all the rows after the thead block into one tbody block. This causes data loss, since we can no longer reconstruct the original table due to loss of the tbody blocks, and makes the table inaccessible to screen readers. CKEditor has also turned row headers in the second column to td elements with a scope attribute, which is invalid, and causes further accessibility issues.
Table 4
CKEditor has added inline styles to col elements (strange), put all the rows after the thead block into one tbody block (again, potential data loss and makes the table inaccessible to screen readers). I'm not sure what the practical implications of this next quirk are, but I want to note it. CKEditor has added a non-breaking space character to an empty th tag. I don't think non-breaking spaces are ASCII whitespace. This means that the header cell is non-empty and user agents (including screen readers) should add it to the header list for the cells beneath it, according to the spec.
❓ Possible solution
Add some kind of data attribute that tells CKEditor to not parse the table. Or just follow the table parsing algorithm from the HTML5 spec.
📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: