Skip to content

Support multiple TableBody elements #7312

Open
@mike-wheel

Description

@mike-wheel

Provide a general summary of the issue here

According to the <tbody> MDN documentation:

It's permitted to use more than one <tbody> per table as long as they are all consecutive. This allows to divide the rows (<tr> elements) in large tables into sections, each of which may be separately formatted if so desired.

When I try to add two react-aria <TableBody> elements like this, only the last one is rendered.

🤔 Expected Behavior?

Both <TableBody> elements are rendered.

😯 Current Behavior

<TableBody className="folders"> is not rendered

💁 Possible Solution

I kind of took a look at the code, and it looks like this.body gets overwritten every time in Table.tsx. This logic would need to be updated to concat all the tablebody nodes together in a React.Fragment or something.

🔦 Context

Using multiple <tbody> elements can assist in implemented grouped/collapsible rows, like this https://codepen.io/andornagy/pen/gaGBZz?editors=1000

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/thirsty-panini-d3mgyv
Notice that the first <TableBody className="folders"> is not rendered.

Version

1.3.3

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge, Other

If other, please specify.

No response

What operating system are you using?

macOS Sonoma 14.6.1

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions