From 8544ea38888d17ddaff31831beac39721b3709df Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Mon, 6 Sep 2021 16:18:30 +0200 Subject: [PATCH] Map input[value] to aria-valuenow --- packages/alfa-aria/src/feature.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/alfa-aria/src/feature.ts b/packages/alfa-aria/src/feature.ts index 5405bfb7fe..9a64127020 100644 --- a/packages/alfa-aria/src/feature.ts +++ b/packages/alfa-aria/src/feature.ts @@ -416,14 +416,14 @@ const Features: Features = { yield Attribute.of("aria-controls", value); } - // https://w3c.github.io/html-aam/#att-max-input - for (const { value } of element.attribute("max")) { - yield Attribute.of("aria-valuemax", value); + // https://w3c.github.io/html-aam/#att-disabled + for (const _ of element.attribute("disabled")) { + yield Attribute.of("aria-disabled", "true"); } - // https://w3c.github.io/html-aam/#att-min-input - for (const { value } of element.attribute("min")) { - yield Attribute.of("aria-valuemin", value); + // https://w3c.github.io/html-aam/#att-placeholder + for (const { value } of element.attribute("placeholder")) { + yield Attribute.of("aria-placeholder", value); } // https://w3c.github.io/html-aam/#att-readonly @@ -436,14 +436,20 @@ const Features: Features = { yield Attribute.of("aria-required", "true"); } - // https://w3c.github.io/html-aam/#att-disabled - for (const _ of element.attribute("disabled")) { - yield Attribute.of("aria-disabled", "true"); + // https://w3c.github.io/html-aam/#att-max-input + for (const { value } of element.attribute("max")) { + yield Attribute.of("aria-valuemax", value); } - // https://w3c.github.io/html-aam/#att-placeholder - for (const { value } of element.attribute("placeholder")) { - yield Attribute.of("aria-placeholder", value); + // https://w3c.github.io/html-aam/#att-min-input + for (const { value } of element.attribute("min")) { + yield Attribute.of("aria-valuemin", value); + } + + // https://w3c.github.io/html-aam/#att-value-input + // but https://github.com/w3c/html-aam/issues/314 + for (const { value } of element.attribute("value")) { + yield Attribute.of("aria-valuenow", value); } }, (element, device, state) => {