WordPress / WordPress/accessibility-lab
[Feature]: Add table caption validation check for core/table block
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 3
- Avg merge
- 16h 15m
- Merged PRs (30d)
- 3
Description
Which area does this relate to?
Block validation rule
Is your feature request related to a problem?
Currently, the "Core block accessibility rules" module only validates table headers (check_table_headers).
According to WCAG 1.3.1 (Info and Relationships) and Technique H39, data tables should have an associated <caption> to describe their topic or purpose. Without a caption, screen reader users navigating by tables cannot quickly determine what data the table presents before stepping through cells.
Describe the solution you'd like
Add a check_table_caption validation check to core/table in the Core block accessibility rules module:
- Starting Level:
warning(advisory, as not every small layout table strictly warrants blocking publication, and administrators can elevate it toerrorin Validation Settings if desired). - Behavior:
- Flags a warning if the
captionattribute is empty or contains only whitespace. - Automatically clears once a descriptive caption is provided.
- Flags a warning if the
Describe alternatives you've considered
Considered making it an error level check, but warning is more appropriate to prevent blocking publishes on simple presentation tables while still encouraging accessibility best practices.
Checklist
- I have searched existing issues to make sure this isn't a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Core block accessibility rules module and its existing check_table_headers implementation for core/table. Add the caption validation alongside it, then verify that empty or whitespace-only captions produce a warning and that a descriptive caption clears the warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- accessibility
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100