-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Do not require media captions / descriptions (#1075)
Do not require media captions / descriptions Closes #816 ## Reviewer checks **Required fields, to be filled out by PR reviewer(s)** - [x] Follows the commit message policy, appropriate for next version - [x] Has documentation updated, a DU ticket, or requires no documentation change - [x] Includes new tests, or was unnecessary - [x] Code is reviewed for security by: @JKODU
- Loading branch information
1 parent
01536dd
commit 289f623
Showing
11 changed files
with
54 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
var tracks = axe.utils.querySelectorAll(virtualNode, 'track'); | ||
const tracks = axe.utils.querySelectorAll(virtualNode, 'track'); | ||
const hasCaptions = tracks.some( | ||
({ actualNode }) => | ||
(actualNode.getAttribute('kind') || '').toLowerCase() === 'captions' | ||
); | ||
|
||
if (tracks.length) { | ||
// return false if any track has kind === 'caption' | ||
return !tracks.some( | ||
({ actualNode }) => | ||
(actualNode.getAttribute('kind') || '').toLowerCase() === 'captions' | ||
); | ||
} | ||
// Undefined if there are no tracks - media may be decorative | ||
return undefined; | ||
// Undefined if there are no tracks - media may use another caption method | ||
return hasCaptions ? false : undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
var tracks = axe.utils.querySelectorAll(virtualNode, 'track'); | ||
const tracks = axe.utils.querySelectorAll(virtualNode, 'track'); | ||
const hasDescriptions = tracks.some( | ||
({ actualNode }) => | ||
(actualNode.getAttribute('kind') || '').toLowerCase() === 'descriptions' | ||
); | ||
|
||
if (tracks.length) { | ||
// return false if any track has kind === 'description' | ||
var out = !tracks.some( | ||
({ actualNode }) => | ||
(actualNode.getAttribute('kind') || '').toLowerCase() === 'descriptions' | ||
); | ||
return out; | ||
} | ||
// Undefined if there are no tracks - media may be decorative | ||
return undefined; | ||
// Undefined if there are no tracks - media may have another description method | ||
return hasDescriptions ? false : undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<video id="incomplete1"></video> | ||
<video id="fail1"><track kind="descriptions"></video> | ||
<video id="incomplete2"><track kind="descriptions"></video> | ||
<video id="pass1"><track kind="captions"></video> | ||
<video id="pass2"><track kind="descriptions"><track kind="captions"></video> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"description": "video-caption test", | ||
"rule": "video-caption", | ||
"incomplete": [["#incomplete1"]], | ||
"violations": [["#fail1"]], | ||
"incomplete": [["#incomplete1"], ["#incomplete2"]], | ||
"passes": [["#pass1"], ["#pass2"]] | ||
} |
2 changes: 1 addition & 1 deletion
2
test/integration/rules/video-description/video-description.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
<video id="incomplete1"></video> | ||
<video id="fail1"><track kind="captions"></video> | ||
<video id="incomplete2"><track kind="captions"></video> | ||
<video id="pass1"><track kind="descriptions"></video> | ||
<video id="pass2"><track kind="descriptions"><track kind="captions"></video> |
3 changes: 1 addition & 2 deletions
3
test/integration/rules/video-description/video-description.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"description": "video-description test", | ||
"rule": "video-description", | ||
"incomplete": [["#incomplete1"]], | ||
"violations": [["#fail1"]], | ||
"incomplete": [["#incomplete1"], ["#incomplete2"]], | ||
"passes": [["#pass1"], ["#pass2"]] | ||
} |