diff --git a/packages/alfa-rules/src/common/applicability/video.ts b/packages/alfa-rules/src/common/applicability/video.ts index 120d5fad8d..f606d71cdc 100644 --- a/packages/alfa-rules/src/common/applicability/video.ts +++ b/packages/alfa-rules/src/common/applicability/video.ts @@ -8,11 +8,10 @@ import { Predicate } from "@siteimprove/alfa-predicate"; import { isVisible } from "../predicate/is-visible"; import { Question } from "../question"; -import { hasAttribute } from "../predicate/has-attribute"; const { isElement, hasName, hasNamespace } = Element; const { filter, map, some } = Iterable; -const { and, equals } = Predicate; +const { and } = Predicate; export function video( document: Document, @@ -39,7 +38,23 @@ export function video( Element.isElement, and( hasName("track"), - hasAttribute("kind", equals(track.kind)) + (trackElement) => + trackElement + .attribute("kind") + // @see https://html.spec.whatwg.org/multipage/media.html#attr-track-kind + .map( + (kind) => + kind + .enumerate( + "subtitles", + "captions", + "descriptions", + "chapters", + "metadata" + ) + .getOr("metadata") // invalid value default + ) + .getOr("subtitles") === track.kind // missing value default ) ) )