Skip to content

[docs][Table] Fix wrong number of rows reported to screen readers - #47653

Open
seomsoo wants to merge 4 commits into
mui:masterfrom
seomsoo:fix/voiceover-row-skip
Open

[docs][Table] Fix wrong number of rows reported to screen readers#47653
seomsoo wants to merge 4 commits into
mui:masterfrom
seomsoo:fix/voiceover-row-skip

Conversation

@seomsoo

@seomsoo seomsoo commented Jan 18, 2026

Copy link
Copy Markdown

While collapsed, the demo still renders an empty <TableRow> per dessert to host
the collapsible detail. Those rows remain in the accessibility tree, so the table
is exposed as 11 rows when only 6 exist (header + 5 desserts), and row indices
don't match what is visible.

This marks the detail row as aria-hidden once the collapse transition has
finished, so it is only exposed while it actually has content. The exited state
keeps the row exposed during the animation, and aria-hidden is never applied
while the row contains focusable content.

Verified with VoiceOver in Safari and Chrome: the table is announced as 6 rows
while collapsed.

Original recording (row skipping, no longer reproducible)

https://github.com/user-attachments/assets/cd2af7e6-6290-4aac-aa1e5-040ec8b2695d

Fixes #48960

@mui-bot

mui-bot commented Jan 18, 2026

Copy link
Copy Markdown

Netlify deploy preview

https://deploy-preview-47653--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 3f316a1

@mj12albert mj12albert added the docs Improvements or additions to the documentation. label Jan 19, 2026
@zannager zannager added the scope: table Changes related to the table. label Jan 19, 2026
@zannager
zannager requested a review from mj12albert January 19, 2026 15:27
@zannager
zannager requested review from siriwatknp and removed request for mj12albert July 28, 2026 14:00
@siriwatknp

Copy link
Copy Markdown
Member

Looks solid to me!

@silviuaavram

Copy link
Copy Markdown
Member

@siriwatknp @seomsoo I could not repro the issue. What am I missing? Here I'm using VO navigation with VO + Arrow Right / Left. I'm not skipping any row.

Screen.Recording.2026-08-12.at.17.09.59.mov

@seomsoo

seomsoo commented Aug 13, 2026

Copy link
Copy Markdown
Author

@silviuaavram You're not missing anything. I retested and I think this has changed since the issue was filed.

The demo source hasn't changed since #46381 was opened (the only commit since is #48557, a CSS selector swap for visual regression). But I can't reproduce the row skipping either. I tested the production docs with VoiceOver in Safari and Chrome, and every row is announced and navigation is smooth. It seems to have been fixed on the browser side.

One thing still holds. While collapsed, the table is exposed as 11 rows when there are only 6 (header + 5 desserts), so row indices don't match what's visible. Same in both browsers:

VoiceOver announcing the table as 11 rows, 6 columns

(VoiceOver is set to Korean in the first screenshot.)

But that's a much smaller problem than the original "unusable", and I'm not sure it justifies the change on its own.

The aria-expanded part seems worth keeping regardless, since the expand button doesn't expose its state at all today.

Happy to trim the PR to just that, or close it with the issue if you prefer.

@silviuaavram

Copy link
Copy Markdown
Member

I will close the referenced issue and we can create another one, pointing specifically at the rows issue. Then we can change the PR to close that new issue instead.

@silviuaavram

Copy link
Copy Markdown
Member

#48960

@seomsoo seomsoo changed the title Fix: Collapsible Table demo row skipping with VoiceOver [docs] Fix wrong number of rows reported by screen readers in Collapsible Table demo Aug 13, 2026
@code-infra-dashboard

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@seomsoo seomsoo changed the title [docs] Fix wrong number of rows reported by screen readers in Collapsible Table demo [docs][Table] Fix wrong number of rows reported to screen readers Aug 13, 2026
@seomsoo

seomsoo commented Aug 13, 2026

Copy link
Copy Markdown
Author

Updated to close #48960.

Verified on the deploy preview: the table is now announced as 6 rows while
collapsed, matching the header plus 5 dessert rows.

VoiceOver announcing the collapsible table as 6 columns, 6 rows

(VoiceOver is set to Korean in the screenshot.)

@silviuaavram

Copy link
Copy Markdown
Member

Taking a look. There are some more possible fixes to be done. Will list them all.

@silviuaavram silviuaavram left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just realized that I commented on the js file, but feel free to apply the comments to the tsx. Overall looks good, we should be ready once the comments are addressed. Thanks!

function Row(props) {
const { row } = props;
const [open, setOpen] = React.useState(false);
const [exited, setExited] = React.useState(true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm OK if we just use open for aria-hidden. We can consider that while the animation is collapsing, the row is considered hidden for screen readers.

<TableRow sx={{ '& > .MuiTableCell-root': { borderBottom: 'unset' } }}>
<TableCell>
<IconButton
aria-label="expand row"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's also change this aria-label, depending on open, to narrate expand / collapse

<TableCell>
<IconButton
aria-label="expand row"
aria-expanded={open}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's also add aria-controls pointing to the row element which is controlled by this button.

<TableCell align="right">{row.protein}</TableCell>
</TableRow>
<TableRow>
<TableRow aria-hidden={!open && exited ? true : undefined}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

feel free to add an id here with React.useId or add an id field to the data object and use that, so it can be linked to the button aria-controls

in={open}
timeout="auto"
unmountOnExit
onEnter={() => setExited(false)}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cleanup here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. scope: table Changes related to the table.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] The collapsible table example reports wrong number of rows to the screen reader

6 participants