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

subcaption / nested caption tag #9865

Open
Pandapip1 opened this issue Oct 18, 2023 · 3 comments
Open

subcaption / nested caption tag #9865

Pandapip1 opened this issue Oct 18, 2023 · 3 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@Pandapip1
Copy link

Pandapip1 commented Oct 18, 2023

What problem are you trying to solve?

I have five or six tables that all display the same type of data and are seperated by status. I would like to do this in a single table so that the columns have a consistent width.

What solutions exist today?

You can use an h2 in between multiple tables. But then the tables have different column widths.

How would you solve it?

New

A nested caption tag (as a first child of a tbody tag) indicates the caption for the specific tbody. It may have a different default style from a caption that isn't a child of a tbody:

<table>
    <caption>Cool data!</caption>
    <thead>
        <tr>
            <th>Column 1</th>
            <th>Column 2</th>
        </tr>
    </thead>
    <tbody>
        <caption>Status 1</caption>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
        <tr>
            <td>Data 3</td>
            <td>Data 4</td>
        </tr>
    </tbody>
    <tbody>
        <caption>Status 2</caption>
        <tr>
            <td>Data 5</td>
            <td>Data 6</td>
        </tr>
        <tr>
            <td>Data 7</td>
            <td>Data 8</td>
        </tr>
    </tbody>
</table>

Old

A new HTML tag, subcaption, that behaves identically to the caption tag, except it can be placed only after the thead and before the last tbody, but any number of times, and might have different default styling. For example:

<table>
    <caption>Cool data!</caption>
    <thead>
        <tr>
            <th>Column 1</th>
            <th>Column 2</th>
        </tr>
    </thead>
    <subcaption>Status 1</subcaption>
    <tbody>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
        <tr>
            <td>Data 3</td>
            <td>Data 4</td>
        </tr>
    </tbody>
    <subcaption>Status 2</subcaption>
    <tbody>
        <tr>
            <td>Data 5</td>
            <td>Data 6</td>
        </tr>
        <tr>
            <td>Data 7</td>
            <td>Data 8</td>
        </tr>
    </tbody>
</table>

Anything else?

Alternatively, some sort of CSS property could be made to sync columns across tables. I haven't thought about this that much. All I know is that I want to avoid using JS for something this simple.

The presence ot absence of this feature could possibly be used for fingerprinting.

@Pandapip1 Pandapip1 added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Oct 18, 2023
@Pandapip1 Pandapip1 changed the title tsubcaption tag subcaption` tag Oct 18, 2023
@Pandapip1 Pandapip1 changed the title subcaption` tag subcaption tag Oct 18, 2023
@Crissov
Copy link

Crissov commented Oct 19, 2023

Instead of

    <subcaption>Status 1</subcaption>
    <tbody>
        <td>Data 1</td>

all of the following, nesting within tbody, would make more structural sense to me:

    <tbody>
        <subcaption>Status 1</subcaption>
        <td>Data 1</td>
    <tbody>
        <caption>Status 1</caption>
        <td>Data 1</td>
    <tbody>
        <h2>Status 1</h2>
        <td>Data 1</td>

@Pandapip1
Copy link
Author

I like your second option of tbody caption the best.

@Pandapip1 Pandapip1 changed the title subcaption tag subcaption / nested caption tag Oct 23, 2023
@past past added agenda+ To be discussed at a triage meeting and removed agenda+ To be discussed at a triage meeting labels Oct 31, 2023
@prlbr
Copy link

prlbr commented Nov 13, 2023

Can you use

<tbody>
  <tr><th colspan='' scope='rowgroup'>Status 1</th></tr></tbody>

instead of a <caption> or <subcaption> element?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

4 participants