WordPress / WordPress/accessibility-lab

[Feature]: Add table caption validation check for core/table block

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

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 to error in Validation Settings if desired).
  • Behavior:
    • Flags a warning if the caption attribute is empty or contains only whitespace.
    • Automatically clears once a descriptive caption is provided.
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.