Repository navigation
Add video captions validation check for core/video block - #31
huzaifaalmesbah wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks for the contribution, @huzaifaalmesbah, the implementation looks solid. Unlike the table caption check, this one's citing an actual Level A success criterion (1.2.2), so a missing caption on a video with dialogue or relevant audio is a genuine conformance failure, not just a best-practice suggestion. That makes One thing I'd want to confirm before merging: does the check have any way to distinguish videos with meaningful audio from silent/decorative video? Right now it looks like any |
Block attributes can't tell us whether a video has audio, but a muted, looping, autoplaying video with controls hidden is a background clip with nothing to caption, so don't flag it. Also count tracks saved without a kind, since <track> defaults to subtitles.
6d3b5c2 to
d0a7d55
Compare
|
Thanks @troychaplin! Good question. Block attributes don't tell us whether a video has audio, so the check can't reliably tell a video with dialogue from a silent one. That's why I kept the default at In d0a7d55 I added a heuristic for the clearest case: a video that autoplays, is muted, loops and has controls hidden is treated as a background/decorative clip and isn't flagged. I also count tracks saved without a If the team prefers |
What?
Closes #30
This PR adds a new WCAG-oriented validation check
check_video_tracksfor thecore/videoblock in the Core block accessibility rules module.Why?
Under WCAG 2.1 Success Criterion 1.2.2 (Captions - Prerecorded - Level A), prerecorded videos containing audio dialogue and relevant sounds must provide synchronized text captions or subtitles so that deaf or hard-of-hearing users can consume the media content.
Currently, the Core block accessibility rules module does not validate
core/videoblocks. Introducing an advisorywarningcheck reminds content authors to provide caption tracks without blocking the post publishing flow.How?
check_video_tracksundercore/videoinincludes/Modules/Features/Core_Block_Validation_Rules.phpatlevel: warning.src/editor/core-block-rules/video.tsand connected it insrc/editor/core-block-rules/index.ts. It inspectsattributes.tracksto ensure at least one track withkind === 'captions'orkind === 'subtitles'and a validsrcis present.core/videoblock is inserted without an attached video source (srcorid), the check passes cleanly to avoid premature false-positive warnings.error,warning, ornone).README.md,readme.txt, anddocs/features/validation-api.mdto documentcore/videosupport.Testing Instructions
/video) and attach a video file or external URL.validation-api-block-warning), and the sidebar displays:0 errors, 0 warnings).Testing Instructions for Keyboard
Tab)./video).Tab/Shift+Tabto navigate to the editor header and activate the Validation sidebar button.Screenshots or screencast
Use of AI Tools
AI assistance: Yes
Tool(s): Google Antigravity
Used for: Architecture analysis, TypeScript/PHP implementation, local testing & validation in browser, and PR formatting. Reviewed and verified locally.