Skip to content

Commit

Permalink
fix: added support for unknownXXXHazard
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweck committed Dec 2, 2024
1 parent e379088 commit c15a34d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
21 changes: 15 additions & 6 deletions packages/ace-core/src/checker/checker-epub.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,33 +140,42 @@ function checkMetadata(assertions, epub) {
}))
}
if (name === 'schema:accessibilityHazard') {
if (values.includes('flashing') && values.includes('noFlashingHazard')) {
if (values.includes('flashing') && values.includes('noFlashingHazard')
|| values.includes('flashing') && values.includes('unknownFlashingHazard')
|| values.includes('noFlashingHazard') && values.includes('unknownFlashingHazard')
) {
assertions.withAssertions(newViolation({
impact: 'moderate',
title: `metadata-${name.toLowerCase().replace('schema:', '')}-invalid`,
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'flashing/noFlashingHazard', name, interpolation: { escapeValue: false } }),
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'flashing/noFlashingHazard/unknownFlashingHazard', name, interpolation: { escapeValue: false } }),
resDesc: localize("checkepub.metadatainvalid.resdesc", { name, interpolation: { escapeValue: false } }),
kbPath: 'docs/metadata/schema.org/index.html',
kbTitle: localize("checkepub.metadatainvalid.kbtitle"),
ruleDesc: localize("checkepub.metadatainvalid.ruledesc", { name, interpolation: { escapeValue: false } })
}))
}
if (values.includes('motionSimulation') && values.includes('noMotionSimulationHazard')) {
if (values.includes('motionSimulation') && values.includes('noMotionSimulationHazard')
|| values.includes('motionSimulation') && values.includes('unknownMotionSimultationHazard')
|| values.includes('noMotionSimulationHazard') && values.includes('unknownMotionSimultationHazard')
) {
assertions.withAssertions(newViolation({
impact: 'moderate',
title: `metadata-${name.toLowerCase().replace('schema:', '')}-invalid`,
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'motionSimulation/noMotionSimulationHazard', name, interpolation: { escapeValue: false } }),
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'motionSimulation/noMotionSimulationHazard/unknownMotionSimultationHazard', name, interpolation: { escapeValue: false } }),
resDesc: localize("checkepub.metadatainvalid.resdesc", { name, interpolation: { escapeValue: false } }),
kbPath: 'docs/metadata/schema.org/index.html',
kbTitle: localize("checkepub.metadatainvalid.kbtitle"),
ruleDesc: localize("checkepub.metadatainvalid.ruledesc", { name, interpolation: { escapeValue: false } })
}))
}
if (values.includes('sound') && values.includes('noSoundHazard')) {
if (values.includes('sound') && values.includes('noSoundHazard')
|| values.includes('sound') && values.includes('unknownSoundHazard')
|| values.includes('noSoundHazard') && values.includes('unknownSoundHazard')
) {
assertions.withAssertions(newViolation({
impact: 'moderate',
title: `metadata-${name.toLowerCase().replace('schema:', '')}-invalid`,
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'sound/noSoundHazard', name, interpolation: { escapeValue: false } }),
testDesc: localize("checkepub.metadatainvalid.testdesc", { value: 'sound/noSoundHazard/unknownSoundHazard', name, interpolation: { escapeValue: false } }),
resDesc: localize("checkepub.metadatainvalid.resdesc", { name, interpolation: { escapeValue: false } }),
kbPath: 'docs/metadata/schema.org/index.html',
kbTitle: localize("checkepub.metadatainvalid.kbtitle"),
Expand Down
10 changes: 5 additions & 5 deletions packages/ace-core/src/core/a11y-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const A11Y_META = {
'fullMouseControl',
'fullSwitchControl',
'fullTouchControl',
'fullVideoControl',
'fullVideoControl',
'fullVoiceControl',
// 'fullAudioControl',
]
Expand All @@ -165,7 +165,7 @@ const A11Y_META = {
'tableOfContents',
'taggedPDF',
// https://www.w3.org/community/reports/a11y-discov-vocab/CG-FINAL-vocabulary-20230523/#adaptation-terms
'alternativeText',
'alternativeText',
'audioDescription',
'captions', // deprecated => closedCaptions, openCaptions
'closedCaptions',
Expand Down Expand Up @@ -214,11 +214,11 @@ const A11Y_META = {
allowedValues: [
// https://www.w3.org/community/reports/a11y-discov-vocab/CG-FINAL-vocabulary-20230523/#accessibilityHazard-vocabulary
'flashing',
'noFlashingHazard',
'noFlashingHazard', 'unknownFlashingHazard',
'motionSimulation',
'noMotionSimulationHazard',
'noMotionSimulationHazard', 'unknownMotionSimultationHazard',
'sound',
'noSoundHazard',
'noSoundHazard', 'unknownSoundHazard',
'unknown',
'none',
]
Expand Down

0 comments on commit c15a34d

Please sign in to comment.