diff --git a/package-lock.json b/package-lock.json index a374ae9b32..66cfe635fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,14 +19,14 @@ "@rollup/plugin-typescript": "^2.0.1", "@rollup/plugin-virtual": "^3.0.1", "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0", - "@types/aria-query": "^5.0.0", + "@types/aria-query": "^5.0.1", "@types/mocha": "^7.0.0", "@types/node": "^8.10.53", "@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/parser": "^5.29.0", "acorn": "^8.8.1", "agadoo": "^3.0.0", - "aria-query": "^5.1.1", + "aria-query": "^5.1.3", "axobject-query": "^3.1.1", "code-red": "^1.0.0", "css-tree": "^2.3.1", @@ -505,9 +505,9 @@ "dev": true }, "node_modules/@types/aria-query": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.0.tgz", - "integrity": "sha512-P+dkdFu0n08PDIvw+9nT9ByQnd+Udc8DaWPb9HKfaPwCvWvQpC5XaMRx2xLWECm9x1VKNps6vEAlirjA6+uNrQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", + "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", "dev": true }, "node_modules/@types/estree": { @@ -955,9 +955,9 @@ } }, "node_modules/aria-query": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.1.tgz", - "integrity": "sha512-4cPQjOYM2mqq7mZG8CSxkUvL2Yv/x29VhGq5LKehTsxRnoVQps1YGt9NyjcNQsznEsD4rr8a6zGxqeNTqJWjpA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", "dev": true, "dependencies": { "deep-equal": "^2.0.5" @@ -5736,9 +5736,9 @@ "from": "@sveltejs/eslint-config@github:sveltejs/eslint-config#v5.8.0" }, "@types/aria-query": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.0.tgz", - "integrity": "sha512-P+dkdFu0n08PDIvw+9nT9ByQnd+Udc8DaWPb9HKfaPwCvWvQpC5XaMRx2xLWECm9x1VKNps6vEAlirjA6+uNrQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", + "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", "dev": true }, "@types/estree": { @@ -6042,9 +6042,9 @@ } }, "aria-query": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.1.tgz", - "integrity": "sha512-4cPQjOYM2mqq7mZG8CSxkUvL2Yv/x29VhGq5LKehTsxRnoVQps1YGt9NyjcNQsznEsD4rr8a6zGxqeNTqJWjpA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", "dev": true, "requires": { "deep-equal": "^2.0.5" diff --git a/package.json b/package.json index 1c8d3bceab..b7a62f91c6 100644 --- a/package.json +++ b/package.json @@ -129,14 +129,14 @@ "@rollup/plugin-typescript": "^2.0.1", "@rollup/plugin-virtual": "^3.0.1", "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0", - "@types/aria-query": "^5.0.0", + "@types/aria-query": "^5.0.1", "@types/mocha": "^7.0.0", "@types/node": "^8.10.53", "@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/parser": "^5.29.0", "acorn": "^8.8.1", "agadoo": "^3.0.0", - "aria-query": "^5.1.1", + "aria-query": "^5.1.3", "axobject-query": "^3.1.1", "code-red": "^1.0.0", "css-tree": "^2.3.1", diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 416f1d7b31..0fdea77c16 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -23,7 +23,7 @@ import { string_literal } from '../utils/stringify'; import { Literal } from 'estree'; import compiler_warnings from '../compiler_warnings'; import compiler_errors from '../compiler_errors'; -import { ARIARoleDefintionKey, roles, aria, ARIAPropertyDefinition, ARIAProperty } from 'aria-query'; +import { ARIARoleDefinitionKey, roles, aria, ARIAPropertyDefinition, ARIAProperty } from 'aria-query'; import { is_interactive_element, is_non_interactive_roles, is_presentation_role, is_interactive_roles, is_hidden_from_screen_reader, is_semantic_role_element } from '../utils/a11y'; const aria_attributes = 'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(' '); @@ -566,7 +566,7 @@ export default class Element extends Node { const value = attribute.get_static_value(); if (typeof value === 'string') { - value.split(regex_any_repeated_whitespaces).forEach((current_role: ARIARoleDefintionKey) => { + value.split(regex_any_repeated_whitespaces).forEach((current_role: ARIARoleDefinitionKey) => { if (current_role && aria_role_abstract_set.has(current_role)) { component.warn(attribute, compiler_warnings.a11y_no_abstract_role(current_role)); } else if (current_role && !aria_role_set.has(current_role)) { @@ -640,7 +640,7 @@ export default class Element extends Node { // click-events-have-key-events if (handlers_map.has('click')) { const role = attribute_map.get('role'); - const is_non_presentation_role = role?.is_static && !is_presentation_role(role.get_static_value() as ARIARoleDefintionKey); + const is_non_presentation_role = role?.is_static && !is_presentation_role(role.get_static_value() as ARIARoleDefinitionKey); if ( !this.is_dynamic_element && @@ -664,7 +664,7 @@ export default class Element extends Node { } // no-noninteractive-tabindex - if (!this.is_dynamic_element && !is_interactive_element(this.name, attribute_map) && !is_interactive_roles(attribute_map.get('role')?.get_static_value() as ARIARoleDefintionKey)) { + if (!this.is_dynamic_element && !is_interactive_element(this.name, attribute_map) && !is_interactive_roles(attribute_map.get('role')?.get_static_value() as ARIARoleDefinitionKey)) { const tab_index = attribute_map.get('tabindex'); if (tab_index && (!tab_index.is_static || Number(tab_index.get_static_value()) >= 0)) { component.warn(this, compiler_warnings.a11y_no_noninteractive_tabindex); @@ -673,7 +673,7 @@ export default class Element extends Node { // role-supports-aria-props const role = attribute_map.get('role'); - const role_value = (role ? role.get_static_value() : get_implicit_role(this.name, attribute_map)) as ARIARoleDefintionKey; + const role_value = (role ? role.get_static_value() : get_implicit_role(this.name, attribute_map)) as ARIARoleDefinitionKey; if (typeof role_value === 'string' && roles.has(role_value)) { const { props } = roles.get(role_value); const invalid_aria_props = new Set(aria.keys().filter(attribute => !(attribute in props))); diff --git a/src/compiler/compile/utils/a11y.ts b/src/compiler/compile/utils/a11y.ts index d51125fa92..60cb31c663 100644 --- a/src/compiler/compile/utils/a11y.ts +++ b/src/compiler/compile/utils/a11y.ts @@ -1,5 +1,5 @@ import { - ARIARoleDefintionKey, + ARIARoleDefinitionKey, roles as roles_map, elementRoles, ARIARoleRelationConcept @@ -32,17 +32,17 @@ const interactive_roles = new Set( non_abstract_roles.filter((name) => !non_interactive_roles.has(name)) ); -export function is_non_interactive_roles(role: ARIARoleDefintionKey) { +export function is_non_interactive_roles(role: ARIARoleDefinitionKey) { return non_interactive_roles.has(role); } -export function is_interactive_roles(role: ARIARoleDefintionKey) { +export function is_interactive_roles(role: ARIARoleDefinitionKey) { return interactive_roles.has(role); } const presentation_roles = new Set(['presentation', 'none']); -export function is_presentation_role(role: ARIARoleDefintionKey) { +export function is_presentation_role(role: ARIARoleDefinitionKey) { return presentation_roles.has(role); } @@ -141,7 +141,7 @@ export function is_interactive_element( return false; } -export function is_semantic_role_element(role: ARIARoleDefintionKey, tag_name: string, attribute_map: Map) { +export function is_semantic_role_element(role: ARIARoleDefinitionKey, tag_name: string, attribute_map: Map) { for (const [schema, ax_object] of elementAXObjects.entries()) { if (schema.name === tag_name && (!schema.attributes || schema.attributes.every( (attr) => attribute_map.has(attr.name) && attribute_map.get(attr.name).get_static_value() === attr.value