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

Improve Accessibility - captions #957

Merged
merged 2 commits into from Jan 24, 2024
Merged

Conversation

lalong13
Copy link
Contributor

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption

A caption functions like a heading for a table. Most screen readers announce the content of captions. Captions help users to find a table and understand what it’s about and decide if they want to read it. If the user uses “Tables Mode”, captions are the primary mechanism to identify tables. The caption is provided by the element.

from: https://www.w3.org/WAI/tutorials/tables/caption-summary/

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption

> A caption functions like a heading for a table. Most screen readers announce the content of captions. Captions help users to find a table and understand what it’s about and decide if they want to read it. If the user uses “Tables Mode”, captions are the primary mechanism to identify tables. The caption is provided by the <caption> element.

from: https://www.w3.org/WAI/tutorials/tables/caption-summary/
Copy link

vercel bot commented Jan 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
material-react-table ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 2:53am
material-react-table-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 2:53am

@KevinVandy
Copy link
Owner

I'm open to adding a caption slot, but more work would be needed here. Nothing was added to the types yet.

Copy link
Owner

@KevinVandy KevinVandy left a comment

Choose a reason for hiding this comment

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

needs types, and maybe it should be renderCaption?

@KevinVandy
Copy link
Owner

and we'll need to make a few storybook examples showing how to use this, and what it looks like

@lalong13
Copy link
Contributor Author

Thanks for the quick response. I don't actually use TypeScript tho I think I can read through it well enough. I'm glad you support the idea. I can look into what would need to be added to make this compliant with the rest of the code base.

If it is renderCaption, do you think it makes sense to have just a string? I was thinking of allowing JSX so that the caption could be visible only to screen readers with the addition of some css/style. This would probably be my own use case.

@KevinVandy
Copy link
Owner

I guess it could just be a string in caption. I'll check out the branch and add some examples and types

@KevinVandy
Copy link
Owner

Currently still having a problem with the mui Table component where the caption renders at the bottom of the table no matter what caption-side is specified, but will merge what's done for now

image

@KevinVandy
Copy link
Owner

nvm fixed it in the examples

@lalong13
Copy link
Contributor Author

Thank you Kevin! I was going to look into making the updates you recommended this morning, but I see you have already fixed everything up. I greatly appreciate the effort!

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.

None yet

2 participants