From 7e6d8e4b4a84e73941b2af54039746a230ac78d7 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Fri, 12 Jul 2024 12:42:33 +0530 Subject: [PATCH 1/8] Added rule for prohibiting use of aria-hidden and role=presentaion on focusable elements --- ...tation-role-or-aria-hidden-on-focusable.md | 68 +++++++++++++++++++ ...n-role-or-aria-hidden-on-focusable.test.ts | 35 ++++++++++ ...tation-role-or-aria-hidden-on-focusable.ts | 55 +++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md create mode 100644 src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts create mode 100644 src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts diff --git a/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md b/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md new file mode 100644 index 00000000..ed0424cb --- /dev/null +++ b/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md @@ -0,0 +1,68 @@ +# no-presentaion-or-aria-hidden-on-focusbable + +Elements cannot use role='presentation' or aria-hidden='true' on focusable element. Using either of these on a focusable element or parent of a focusbale element will result in some users focusing on 'nothing'. See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). + + +### ✔ Succeed +```vue + +``` + +```vue + +``` + + +```vue + +``` + +```vue + +``` + +```vue + +``` + +```vue + +``` + +### ❌ Fail + +```vue + +``` + +```vue + +``` +```vue + +``` +```vue + +``` \ No newline at end of file diff --git a/src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts b/src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts new file mode 100644 index 00000000..aebfbb63 --- /dev/null +++ b/src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts @@ -0,0 +1,35 @@ +import rule from '../no-presentation-role-or-aria-hidden-on-focusable'; +import makeRuleTester from "./makeRuleTester"; + +makeRuleTester('no-presentation-role-or-aria-hidden-on-focusable', rule, { + valid: [ + "", + "", + "
", + "link", + "", + "" + ], + invalid: [ + { + code: "", + errors: [{messageId: "default"}] + }, + { + code: "", + errors: [{messageId: "default"}] + }, + { + code: "", + errors: [{messageId: "default"}] + }, + { + code: "", + errors: [{messageId: "default"}] + }, + { + code: "Icon", + errors: [{messageId: "default"}] + } + ] +}) \ No newline at end of file diff --git a/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts b/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts new file mode 100644 index 00000000..0900154c --- /dev/null +++ b/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts @@ -0,0 +1,55 @@ +import type { Rule } from "eslint"; +import type { AST } from "vue-eslint-parser"; + +import { defineTemplateBodyVisitor, getElementAttributeValue, makeDocsURL } from "../utils"; + +const focusableElements = [ + 'button', + 'a', + 'input', + 'select', + 'textarea', + '[tabindex]', + '[contenteditable]' +]; + +const hasFocusableElements = (element: AST.VElement): boolean => { + if (focusableElements.includes(element.name) || element.startTag.attributes.some(attr => focusableElements.includes(`[${attr.key.name}]`))) { + if(getElementAttributeValue(element, 'tabindex') === '-1') { + return false; + } + return true; + } + return element.children.some(child => child.type === `VElement` && hasFocusableElements(child)); +}; + +const rule: Rule.RuleModule = { + meta: { + type: "problem", + docs: { + url: makeDocsURL("no-presentation-or-aria-hidden-on-focusable") + }, + messages: { + default: "Focusable/Interactive elements must not have a presentation role or aria-hidden attribute." + }, + schema: [] + }, + create(context) { + return defineTemplateBodyVisitor(context, { + VElement(node) { + const hasAriaHidden = getElementAttributeValue(node, 'aria-hidden'); + const hasRolePresentation = getElementAttributeValue(node, 'role') === 'presentation'; + if (hasAriaHidden || hasRolePresentation) { + if (hasFocusableElements(node)) { + context.report({ + node: node as any, + messageId: 'default', + }); + } + } + }, + }); + } +} + +export default rule; \ No newline at end of file From 05a3cab3212579129bfa6b6ed4a7a1020a521a88 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Sun, 14 Jul 2024 15:30:06 +0530 Subject: [PATCH 2/8] Refactored code into seprate files and utility file --- docs/rules/no-aria-hidden-on-focusable.md | 77 +++++++++++++++++++ ...tation-role-or-aria-hidden-on-focusable.md | 68 ---------------- .../no-role-presentation-on-focusable.md | 77 +++++++++++++++++++ ...ts => no-aria-hidden-on-focusable.test.ts} | 14 ++-- .../no-role-presentation-on-focusable.test.ts | 31 ++++++++ src/rules/no-aria-hidden-on-focusable.ts | 34 ++++++++ ...tation-role-or-aria-hidden-on-focusable.ts | 55 ------------- .../no-role-presentation-on-focusable.ts | 35 +++++++++ src/utils.ts | 1 + src/utils/hasFocusableElement.ts | 19 +++++ 10 files changed, 279 insertions(+), 132 deletions(-) create mode 100644 docs/rules/no-aria-hidden-on-focusable.md delete mode 100644 docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md create mode 100644 docs/rules/no-role-presentation-on-focusable.md rename src/rules/__tests__/{no-presentation-role-or-aria-hidden-on-focusable.test.ts => no-aria-hidden-on-focusable.test.ts} (62%) create mode 100644 src/rules/__tests__/no-role-presentation-on-focusable.test.ts create mode 100644 src/rules/no-aria-hidden-on-focusable.ts delete mode 100644 src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts create mode 100644 src/rules/no-role-presentation-on-focusable.ts create mode 100644 src/utils/hasFocusableElement.ts diff --git a/docs/rules/no-aria-hidden-on-focusable.md b/docs/rules/no-aria-hidden-on-focusable.md new file mode 100644 index 00000000..ceccffee --- /dev/null +++ b/docs/rules/no-aria-hidden-on-focusable.md @@ -0,0 +1,77 @@ +# no-aria-hidden-on-focusbable + +Enforce that `aria-hidden="true"` is not set on focusable elements or parent of focusable elements. + +`aria-hidden="true"` can be used to hide purely decorative content from screen reader users. An element with `aria-hidden="true"` that can also be reached by keyboard can lead to confusion or unexpected behavior for screen reader users. Avoid using `aria-hidden="true"` on focusable elements. + + See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). + + +### ✔ Succeed +```vue + +``` + +```vue + +``` + + +```vue + +``` + +```vue + +``` + +```vue + +``` + +```vue + +``` + +### ❌ Fail + +```vue + +``` + +```vue + +``` +```vue + +``` +```vue + +``` +```vue + +``` \ No newline at end of file diff --git a/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md b/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md deleted file mode 100644 index ed0424cb..00000000 --- a/docs/rules/no-presentation-role-or-aria-hidden-on-focusable.md +++ /dev/null @@ -1,68 +0,0 @@ -# no-presentaion-or-aria-hidden-on-focusbable - -Elements cannot use role='presentation' or aria-hidden='true' on focusable element. Using either of these on a focusable element or parent of a focusbale element will result in some users focusing on 'nothing'. See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). - - -### ✔ Succeed -```vue - -``` - -```vue - -``` - - -```vue - -``` - -```vue - -``` - -```vue - -``` - -```vue - -``` - -### ❌ Fail - -```vue - -``` - -```vue - -``` -```vue - -``` -```vue - -``` \ No newline at end of file diff --git a/docs/rules/no-role-presentation-on-focusable.md b/docs/rules/no-role-presentation-on-focusable.md new file mode 100644 index 00000000..1dbc965f --- /dev/null +++ b/docs/rules/no-role-presentation-on-focusable.md @@ -0,0 +1,77 @@ +# no-role-presentaion-on-focusbable + +Enforce that `role="presentation"` is not set on focusable elements or parent of focusbale elements. + +`role="presentation` can be used to hide purely decorative content from screen reader users. An element with `role="presentation"` that can also be reached by keyboard can lead to confusion or unexpected behavior for screen reader users. Avoid using `role="presentation"` on focusable elements. + + See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). + + +### ✔ Succeed +```vue + +``` + +```vue + +``` + + +```vue + +``` + +```vue + +``` + +```vue + +``` + +```vue + +``` + +### ❌ Fail + +```vue + +``` + +```vue + +``` +```vue + +``` +```vue + +``` +```vue + +``` \ No newline at end of file diff --git a/src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts b/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts similarity index 62% rename from src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts rename to src/rules/__tests__/no-aria-hidden-on-focusable.test.ts index aebfbb63..584079b5 100644 --- a/src/rules/__tests__/no-presentation-role-or-aria-hidden-on-focusable.test.ts +++ b/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts @@ -1,13 +1,13 @@ -import rule from '../no-presentation-role-or-aria-hidden-on-focusable'; +import rule from '../no-aria-hidden-on-focusable'; import makeRuleTester from "./makeRuleTester"; makeRuleTester('no-presentation-role-or-aria-hidden-on-focusable', rule, { valid: [ "", - "", + "", "
", - "link", - "", + "link", + "", "" ], invalid: [ @@ -15,10 +15,6 @@ makeRuleTester('no-presentation-role-or-aria-hidden-on-focusable', rule, { code: "", errors: [{messageId: "default"}] }, - { - code: "", - errors: [{messageId: "default"}] - }, { code: "", errors: [{messageId: "default"}] @@ -28,7 +24,7 @@ makeRuleTester('no-presentation-role-or-aria-hidden-on-focusable', rule, { errors: [{messageId: "default"}] }, { - code: "Icon", + code: "", errors: [{messageId: "default"}] } ] diff --git a/src/rules/__tests__/no-role-presentation-on-focusable.test.ts b/src/rules/__tests__/no-role-presentation-on-focusable.test.ts new file mode 100644 index 00000000..aec9d75b --- /dev/null +++ b/src/rules/__tests__/no-role-presentation-on-focusable.test.ts @@ -0,0 +1,31 @@ +import rule from '../no-role-presentation-on-focusable'; +import makeRuleTester from "./makeRuleTester"; + +makeRuleTester('no-role-presentation-role-on-focusable', rule, { + valid: [ + "", + "
", + "
", + "link", + "", + "
Link
" + ], + invalid: [ + { + code: "
", + errors: [{messageId: "default"}] + }, + { + code: "", + errors: [{messageId: "default"}] + }, + { + code: "Link", + errors: [{messageId: "default"}] + }, + { + code: "Icon", + errors: [{messageId: "default"}] + } + ] +}) \ No newline at end of file diff --git a/src/rules/no-aria-hidden-on-focusable.ts b/src/rules/no-aria-hidden-on-focusable.ts new file mode 100644 index 00000000..daac3c41 --- /dev/null +++ b/src/rules/no-aria-hidden-on-focusable.ts @@ -0,0 +1,34 @@ +import type { Rule } from "eslint"; + +import { defineTemplateBodyVisitor, getElementAttributeValue, makeDocsURL } from "../utils"; +import hasFocusableElements from "../utils/hasFocusableElement"; + +const rule: Rule.RuleModule = { + meta: { + type: "problem", + docs: { + url: makeDocsURL("no-aria-hidden-on-focusable") + }, + messages: { + default: "Focusable/Interactive elements must not have an aria-hidden attribute." + }, + schema: [] + }, + create(context) { + return defineTemplateBodyVisitor(context, { + VElement(node) { + const hasAriaHidden = getElementAttributeValue(node, 'aria-hidden'); + if (hasAriaHidden) { + if (hasFocusableElements(node)) { + context.report({ + node: node as any, + messageId: 'default', + }); + } + } + }, + }); + } +} + +export default rule; \ No newline at end of file diff --git a/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts b/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts deleted file mode 100644 index 0900154c..00000000 --- a/src/rules/no-presentation-role-or-aria-hidden-on-focusable.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { Rule } from "eslint"; -import type { AST } from "vue-eslint-parser"; - -import { defineTemplateBodyVisitor, getElementAttributeValue, makeDocsURL } from "../utils"; - -const focusableElements = [ - 'button', - 'a', - 'input', - 'select', - 'textarea', - '[tabindex]', - '[contenteditable]' -]; - -const hasFocusableElements = (element: AST.VElement): boolean => { - if (focusableElements.includes(element.name) || element.startTag.attributes.some(attr => focusableElements.includes(`[${attr.key.name}]`))) { - if(getElementAttributeValue(element, 'tabindex') === '-1') { - return false; - } - return true; - } - return element.children.some(child => child.type === `VElement` && hasFocusableElements(child)); -}; - -const rule: Rule.RuleModule = { - meta: { - type: "problem", - docs: { - url: makeDocsURL("no-presentation-or-aria-hidden-on-focusable") - }, - messages: { - default: "Focusable/Interactive elements must not have a presentation role or aria-hidden attribute." - }, - schema: [] - }, - create(context) { - return defineTemplateBodyVisitor(context, { - VElement(node) { - const hasAriaHidden = getElementAttributeValue(node, 'aria-hidden'); - const hasRolePresentation = getElementAttributeValue(node, 'role') === 'presentation'; - if (hasAriaHidden || hasRolePresentation) { - if (hasFocusableElements(node)) { - context.report({ - node: node as any, - messageId: 'default', - }); - } - } - }, - }); - } -} - -export default rule; \ No newline at end of file diff --git a/src/rules/no-role-presentation-on-focusable.ts b/src/rules/no-role-presentation-on-focusable.ts new file mode 100644 index 00000000..ee574d1b --- /dev/null +++ b/src/rules/no-role-presentation-on-focusable.ts @@ -0,0 +1,35 @@ +import type { Rule } from "eslint"; +// import type { AST } from "vue-eslint-parser"; + +import { defineTemplateBodyVisitor, getElementAttributeValue, makeDocsURL } from "../utils"; +import hasFocusableElements from "../utils/hasFocusableElement"; + +const rule: Rule.RuleModule = { + meta: { + type: "problem", + docs: { + url: makeDocsURL("no-role-presentation-on-focusable") + }, + messages: { + default: "Focusable/Interactive elements must not have a presentation role attribute." + }, + schema: [] + }, + create(context) { + return defineTemplateBodyVisitor(context, { + VElement(node) { + const hasRolePresentation = getElementAttributeValue(node, 'role') === 'presentation'; + if (hasRolePresentation) { + if (hasFocusableElements(node)) { + context.report({ + node: node as any, + messageId: 'default', + }); + } + } + }, + }); + } +} + +export default rule; \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts index 14fd542a..290b5870 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -9,6 +9,7 @@ export { default as getInteractiveRoles } from "./utils/getInteractiveRoles"; export { default as hasAccessibleChild } from "./utils/hasAccessibleChild"; export { default as hasAriaLabel } from "./utils/hasAriaLabel"; export { default as hasContent } from "./utils/hasContent"; +export { default as hasFocusableElement } from "./utils/hasFocusableElement"; export { default as hasOnDirective } from "./utils/hasOnDirective"; export { default as hasOnDirectives } from "./utils/hasOnDirectives"; export { default as interactiveHandlers } from "./utils/interactiveHandlers.json"; diff --git a/src/utils/hasFocusableElement.ts b/src/utils/hasFocusableElement.ts new file mode 100644 index 00000000..bfa5e040 --- /dev/null +++ b/src/utils/hasFocusableElement.ts @@ -0,0 +1,19 @@ +import type { AST } from 'vue-eslint-parser'; +import getElementAttributeValue from './getElementAttributeValue'; +import isInteractiveElement from './isInteractiveElement'; + +function hasFocusableElements(node: AST.VElement):boolean { + const tabindex = getElementAttributeValue(node, 'tabindex'); + + if(isInteractiveElement(node)) { + return tabindex !== '-1'; + } + + if(tabindex !== null && tabindex !== '-1') { + return true; + } + + return node.children.some(child => child.type === 'VElement' && hasFocusableElements(child)) +} + +export default hasFocusableElements; \ No newline at end of file From 0b9a565a87ed1f5bcc150320a43d03942999a8d7 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Mon, 15 Jul 2024 19:59:46 +0530 Subject: [PATCH 3/8] Added EOL for files with prettier errors --- src/rules/__tests__/no-aria-hidden-on-focusable.test.ts | 2 +- src/rules/__tests__/no-role-presentation-on-focusable.test.ts | 2 +- src/rules/no-aria-hidden-on-focusable.ts | 2 +- src/rules/no-role-presentation-on-focusable.ts | 2 +- src/utils/hasFocusableElement.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts b/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts index 584079b5..0b0e8da0 100644 --- a/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts +++ b/src/rules/__tests__/no-aria-hidden-on-focusable.test.ts @@ -28,4 +28,4 @@ makeRuleTester('no-presentation-role-or-aria-hidden-on-focusable', rule, { errors: [{messageId: "default"}] } ] -}) \ No newline at end of file +}) diff --git a/src/rules/__tests__/no-role-presentation-on-focusable.test.ts b/src/rules/__tests__/no-role-presentation-on-focusable.test.ts index aec9d75b..1cb79f9a 100644 --- a/src/rules/__tests__/no-role-presentation-on-focusable.test.ts +++ b/src/rules/__tests__/no-role-presentation-on-focusable.test.ts @@ -28,4 +28,4 @@ makeRuleTester('no-role-presentation-role-on-focusable', rule, { errors: [{messageId: "default"}] } ] -}) \ No newline at end of file +}) diff --git a/src/rules/no-aria-hidden-on-focusable.ts b/src/rules/no-aria-hidden-on-focusable.ts index daac3c41..3e701d66 100644 --- a/src/rules/no-aria-hidden-on-focusable.ts +++ b/src/rules/no-aria-hidden-on-focusable.ts @@ -31,4 +31,4 @@ const rule: Rule.RuleModule = { } } -export default rule; \ No newline at end of file +export default rule; diff --git a/src/rules/no-role-presentation-on-focusable.ts b/src/rules/no-role-presentation-on-focusable.ts index ee574d1b..0701e750 100644 --- a/src/rules/no-role-presentation-on-focusable.ts +++ b/src/rules/no-role-presentation-on-focusable.ts @@ -32,4 +32,4 @@ const rule: Rule.RuleModule = { } } -export default rule; \ No newline at end of file +export default rule; diff --git a/src/utils/hasFocusableElement.ts b/src/utils/hasFocusableElement.ts index bfa5e040..603655e1 100644 --- a/src/utils/hasFocusableElement.ts +++ b/src/utils/hasFocusableElement.ts @@ -16,4 +16,4 @@ function hasFocusableElements(node: AST.VElement):boolean { return node.children.some(child => child.type === 'VElement' && hasFocusableElements(child)) } -export default hasFocusableElements; \ No newline at end of file +export default hasFocusableElements; From b3049b1518f40b16aed234b94581370c57076791 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Mon, 15 Jul 2024 20:03:41 +0530 Subject: [PATCH 4/8] Removed nested ifs --- src/rules/no-aria-hidden-on-focusable.ts | 12 +++++------- src/rules/no-role-presentation-on-focusable.ts | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/rules/no-aria-hidden-on-focusable.ts b/src/rules/no-aria-hidden-on-focusable.ts index 3e701d66..240bb48e 100644 --- a/src/rules/no-aria-hidden-on-focusable.ts +++ b/src/rules/no-aria-hidden-on-focusable.ts @@ -18,13 +18,11 @@ const rule: Rule.RuleModule = { return defineTemplateBodyVisitor(context, { VElement(node) { const hasAriaHidden = getElementAttributeValue(node, 'aria-hidden'); - if (hasAriaHidden) { - if (hasFocusableElements(node)) { - context.report({ - node: node as any, - messageId: 'default', - }); - } + if (hasAriaHidden && hasFocusableElements(node)) { + context.report({ + node: node as any, + messageId: 'default', + }); } }, }); diff --git a/src/rules/no-role-presentation-on-focusable.ts b/src/rules/no-role-presentation-on-focusable.ts index 0701e750..861e33e9 100644 --- a/src/rules/no-role-presentation-on-focusable.ts +++ b/src/rules/no-role-presentation-on-focusable.ts @@ -19,13 +19,11 @@ const rule: Rule.RuleModule = { return defineTemplateBodyVisitor(context, { VElement(node) { const hasRolePresentation = getElementAttributeValue(node, 'role') === 'presentation'; - if (hasRolePresentation) { - if (hasFocusableElements(node)) { - context.report({ - node: node as any, - messageId: 'default', - }); - } + if (hasRolePresentation && hasFocusableElements(node)) { + context.report({ + node: node as any, + messageId: 'default', + }); } }, }); From 588572392878b9ca20b48c2a5ecc78911e817727 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Mon, 15 Jul 2024 22:46:17 +0530 Subject: [PATCH 5/8] Fixed EOL errors --- docs/rules/no-aria-hidden-on-focusable.md | 2 +- docs/rules/no-role-presentation-on-focusable.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rules/no-aria-hidden-on-focusable.md b/docs/rules/no-aria-hidden-on-focusable.md index ceccffee..c766083c 100644 --- a/docs/rules/no-aria-hidden-on-focusable.md +++ b/docs/rules/no-aria-hidden-on-focusable.md @@ -74,4 +74,4 @@ Enforce that `aria-hidden="true"` is not set on focusable elements or parent of -``` \ No newline at end of file +``` diff --git a/docs/rules/no-role-presentation-on-focusable.md b/docs/rules/no-role-presentation-on-focusable.md index 1dbc965f..d128d7ca 100644 --- a/docs/rules/no-role-presentation-on-focusable.md +++ b/docs/rules/no-role-presentation-on-focusable.md @@ -74,4 +74,4 @@ Enforce that `role="presentation"` is not set on focusable elements or parent of -``` \ No newline at end of file +``` From 1c2dded21e6c0e06863091f32c8cfe656f41aaf5 Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Mon, 15 Jul 2024 22:52:53 +0530 Subject: [PATCH 6/8] Added more lines --- docs/rules/no-aria-hidden-on-focusable.md | 1 + docs/rules/no-role-presentation-on-focusable.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/rules/no-aria-hidden-on-focusable.md b/docs/rules/no-aria-hidden-on-focusable.md index c766083c..c6a5d596 100644 --- a/docs/rules/no-aria-hidden-on-focusable.md +++ b/docs/rules/no-aria-hidden-on-focusable.md @@ -75,3 +75,4 @@ Enforce that `aria-hidden="true"` is not set on focusable elements or parent of ``` + diff --git a/docs/rules/no-role-presentation-on-focusable.md b/docs/rules/no-role-presentation-on-focusable.md index d128d7ca..b1db7112 100644 --- a/docs/rules/no-role-presentation-on-focusable.md +++ b/docs/rules/no-role-presentation-on-focusable.md @@ -75,3 +75,4 @@ Enforce that `role="presentation"` is not set on focusable elements or parent of Icon ``` + From 492cf15c5a8d9860d986b5c1ce7b348489fe108f Mon Sep 17 00:00:00 2001 From: Paritosh Maurya Date: Tue, 16 Jul 2024 11:09:34 +0530 Subject: [PATCH 7/8] Fixed prettier issues --- docs/rules/no-aria-hidden-on-focusable.md | 33 ++++++----- .../no-role-presentation-on-focusable.md | 31 +++++----- .../no-aria-hidden-on-focusable.test.ts | 58 +++++++++---------- .../no-role-presentation-on-focusable.test.ts | 58 +++++++++---------- src/rules/no-aria-hidden-on-focusable.ts | 53 +++++++++-------- .../no-role-presentation-on-focusable.ts | 54 +++++++++-------- src/utils/hasFocusableElement.ts | 28 ++++----- 7 files changed, 165 insertions(+), 150 deletions(-) diff --git a/docs/rules/no-aria-hidden-on-focusable.md b/docs/rules/no-aria-hidden-on-focusable.md index c6a5d596..bf2701a3 100644 --- a/docs/rules/no-aria-hidden-on-focusable.md +++ b/docs/rules/no-aria-hidden-on-focusable.md @@ -4,23 +4,22 @@ Enforce that `aria-hidden="true"` is not set on focusable elements or parent of `aria-hidden="true"` can be used to hide purely decorative content from screen reader users. An element with `aria-hidden="true"` that can also be reached by keyboard can lead to confusion or unexpected behavior for screen reader users. Avoid using `aria-hidden="true"` on focusable elements. - See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). - +See more in [WAI-ARIA Use in HTML](https://www.w3.org/TR/using-aria/#fourth). ### ✔ Succeed + ```vue ``` ```vue ``` - ```vue