Skip to content

Commit

Permalink
Removed v9
Browse files Browse the repository at this point in the history
  • Loading branch information
REDMOND\shwetasri committed Sep 20, 2024
1 parent 963ef5f commit 1d3bc93
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
# Accessibility: Visual labels should be preferred over aria-label (`@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion-v9`)
# Accessibility: Visual labels should be preferred over aria-label (`@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion`)

💼 This rule is enabled in the ✅ `recommended` config.

<!-- end auto-generated rule header -->

# This rule suggests that visual label is better than aria-label (`visual-label-better-than-aria-suggestion-v9`)

For component like Dropdown, SpinButton, it's good to have a aria-label for screen reader users but visual labels are considered better because they're also useful for sighted user and comes in screen announcement as well.

## Rule Details

This rule aims to...
This rule aims to encourage the usage of visual labels in place of aria-label

Examples of **incorrect** code for this rule:

```js

```jsx
<Dropdown aria-label="This is a Dropdown" />

```

Examples of **correct** code for this rule:

```js

```jsx
<><Label id="my-dropdownid">This is the visual label</Label><Dropdown aria-labelledby="my-dropdownid" /></>

```
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
"spinner-needs-labelling": require("./rules/spinner-needs-labelling"),
"badge-needs-accessible-name": require("./rules/badge-needs-accessible-name"),
"progressbar-needs-labelling": require("./rules/progressbar-needs-labelling"),
"visual-label-better-than-aria-suggestion-v9": require("./rules/visual-label-better-than-aria-suggestion-v9")
"visual-label-better-than-aria-suggestion": require("./rules/visual-label-better-than-aria-suggestion")
},
configs: {
recommended: {
Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports = {
"@microsoft/fluentui-jsx-a11y/dialogsurface-needs-aria": "error",
"@microsoft/fluentui-jsx-a11y/spinner-needs-labelling": "error",
"@microsoft/fluentui-jsx-a11y/progressbar-needs-labelling": "error",
"@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion-v9": "warn"
"@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion": "warn"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { applicableComponents } = require("../../../lib/applicableComponents/butt

const RuleTester = require("eslint").RuleTester;

const rule = require("../../../lib/rules/visual-label-better-than-aria-suggestion-v9");
const rule = require("../../../lib/rules/visual-label-better-than-aria-suggestion");

RuleTester.setDefaultConfig({
parserOptions: {
Expand Down Expand Up @@ -50,7 +50,7 @@ const allTestCases = applicableComponents.flatMap(component => generateTestCases
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();
ruleTester.run("visual-label-better-than-aria-suggestion-v9", rule, {
ruleTester.run("visual-label-better-than-aria-suggestion", rule, {
valid: allTestCases.flatMap(test => test.valid),
invalid: allTestCases.flatMap(test => test.invalid)
});

0 comments on commit 1d3bc93

Please sign in to comment.