Skip to content
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

Fixed Layout Accessiblity technique for Tables #2677

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gautierchomel
Copy link

@gautierchomel gautierchomel commented Jan 28, 2025

@wareid This is a draft proposal for the Table section.

I wonder if we should add the table renderings to the examples.

This is a draft proposal for the Table section. I wonder if we should add the table renderings to the examples.
@gautierchomel
Copy link
Author

Here is a Preview.

It looks like I can't assign reviewers, so naming here @clapierre

@clapierre clapierre requested review from clapierre and wareid January 29, 2025 13:58
Please excuse my french.
<tr>
<th scope="col">Header 1</th>
<th scope="col">Header 2</th>
<th scope="col">Header 3</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing id's for Heading1, Heading2, and Heading3.

Would it be better example to have instead a single Heading1 span all 3 columns
Then have 3 sub-headings 2,3,&4 here.
Then each data cell would refer to the main two column headers="header1 header2", "header1 header3" and "header1 header4"
I haven't seen using the row header as this would normally be spoken anyways.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like:

Complex Data Table with Merged Cells
Header 1
Header 2 Header 3 Header 4
Row 1 Data 1 Data 2
Row 2 Merged Data Data 3
Row 3 Data 4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<table>
    <caption>Complex Data Table with Merged Cells</caption>
    <thead>
        <tr>
            <th id="main-header" colspan="3" scope="col">Header 1</th>
        </tr>
        <tr>
            <th id="sub-header-2" scope="col">Header 2</th>
            <th id="sub-header-3" scope="col">Header 3</th>
            <th id="sub-header-4" scope="col">Header 4</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th scope="row" id="row1">Row 1</th>
            <td headers="main-header sub-header-2">Data 1</td>
            <td headers="main-header sub-header-3">Data 2</td>
        </tr>
        <tr>
            <th scope="row" id="row2">Row 2</th>
            <td headers="main-header sub-header-2" rowspan="2">Merged Data</td>
            <td headers="main-header sub-header-3">Data 3</td>
        </tr>
        <tr>
            <th scope="row" id="row3">Row 3</th>
            <td headers="main-header sub-header-4">Data 4</td>
        </tr>
    </tbody>
</table>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks great!

&lt;/tbody&gt;
&lt;/table&gt;
</pre>
</aside>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a good idea to actually render what the table would look like below the code example?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried but got fouled by CSS and did not have a lovely displayed table.

There will be need for CSS to ensure lovely display.
@gautierchomel
Copy link
Author

gautierchomel commented Jan 29, 2025

Updated Preview

@clapierre
Copy link
Contributor

FIrst example looks great the 2nd table is duplicated with the changes and then followed by the same table without the changes before the rendered view.

@gautierchomel
Copy link
Author

Right, online editing is not the best way for me. It should be fixed now. See updated preview.

<caption>Complex Data Table with Merged Cells</caption>
<thead>
<tr>
<th id="main-header" colspan="3" scope="col">Header 1</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe here the scope should be scope="colgroup"

@clapierre clapierre self-requested a review January 30, 2025 14:41
&lt;caption&gt;Complex Data Table with Merged Cells&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th id="main-header" colspan="3" scope="col"&gt;Header 1&lt;/th&gt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope="colgroup" here as well.

&lt;/table&gt;
</pre>
<p>That will render as:</p>
<table>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding the gridlines will be a nice touch

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but was unable to do so as I don't understand the CSS cascade for those documents...

&lt;/table&gt;
</pre>
<p>That will render as:</p>
<table>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants