You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Make and submit changes following the [pull request submission workflow](#pull-requests)
51
53
54
+
## Recommended VS Code Extensions
55
+
56
+
To ensure a consistent and productive development environment, install the following extensions in Visual Studio Code:
57
+
58
+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) — Linting for JavaScript/TypeScript.
59
+
- [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) — Run or debug Jest tests from context menu.
60
+
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) — Code formatting using Prettier.
61
+
- [Prettier ESLint](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint) — Format code with Prettier and ESLint integration.
62
+
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) — Linting and style checks for Markdown files.
| [breadcrumb-needs-labelling](docs/rules/breadcrumb-needs-labelling.md) | All interactive elements must have an accessible name | ✅ | | |
118
118
| [checkbox-needs-labelling](docs/rules/checkbox-needs-labelling.md) | Accessibility: Checkbox without label must have an accessible and visual label: aria-labelledby | ✅ | | |
119
+
| [colorswatch-needs-labelling](docs/rules/colorswatch-needs-labelling.md) | Accessibility: ColorSwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc.. | ✅ | | |
119
120
| [combobox-needs-labelling](docs/rules/combobox-needs-labelling.md) | All interactive elements must have an accessible name | ✅ | | |
120
121
| [compound-button-needs-labelling](docs/rules/compound-button-needs-labelling.md) | Accessibility: Compound buttons must have accessible labelling: title, aria-label, aria-labelledby, aria-describedby | ✅ | | |
| [dialogbody-needs-title-content-and-actions](docs/rules/dialogbody-needs-title-content-and-actions.md) | A DialogBody should have a header(DialogTitle), content(DialogContent), and footer(DialogActions) | ✅ | | |
123
124
| [dialogsurface-needs-aria](docs/rules/dialogsurface-needs-aria.md) | DialogueSurface need accessible labelling: aria-describedby on DialogueSurface and aria-label or aria-labelledby(if DialogueTitle is missing) | ✅ | | |
124
125
| [dropdown-needs-labelling](docs/rules/dropdown-needs-labelling.md) | Accessibility: Dropdown menu must have an id and it needs to be linked via htmlFor of a Label | ✅ | | |
126
+
| [emptyswatch-needs-labelling](docs/rules/emptyswatch-needs-labelling.md) | Accessibility: EmptySwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc.. | ✅ | | |
125
127
| [field-needs-labelling](docs/rules/field-needs-labelling.md) | Accessibility: Field must have label | ✅ | | |
126
128
| [image-button-missing-aria](docs/rules/image-button-missing-aria.md) | Accessibility: Image buttons must have accessible labelling: title, aria-label, aria-labelledby, aria-describedby | ✅ | | |
129
+
| [imageswatch-needs-labelling](docs/rules/imageswatch-needs-labelling.md) | Accessibility: ImageSwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc.. | ✅ | | |
127
130
| [input-components-require-accessible-name](docs/rules/input-components-require-accessible-name.md) | Accessibility: Input fields must have accessible labelling: aria-label, aria-labelledby or an associated label | ✅ | | |
128
131
| [link-missing-labelling](docs/rules/link-missing-labelling.md) | Accessibility: Image links must have an accessible name. Add either text content, labelling to the image or labelling to the link itself. | ✅ | | 🔧 |
129
132
| [menu-item-needs-labelling](docs/rules/menu-item-needs-labelling.md) | Accessibility: MenuItem without label must have an accessible and visual label: aria-labelledby | ✅ | | |
# Accessibility: ColorSwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc. (`@microsoft/fluentui-jsx-a11y/colorswatch-needs-labelling`)
2
+
3
+
💼 This rule is enabled in the ✅ `recommended` config.
# Accessibility: EmptySwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc. (`@microsoft/fluentui-jsx-a11y/emptyswatch-needs-labelling`)
2
+
3
+
💼 This rule is enabled in the ✅ `recommended` config.
4
+
5
+
<!-- end auto-generated rule header -->
6
+
7
+
All interactive elements must have an accessible name.
8
+
9
+
`EmptySwatch` without a supported label lacks an accessible name for assistive technology users.
10
+
11
+
## Allowed labelling strategies
12
+
13
+
- ✅ `aria-label`**on `EmptySwatch`**
14
+
- ✅ `aria-labelledby`**on `EmptySwatch`**
15
+
- ✅ `htmlFor`/`id` (native `<label htmlFor="…">` ↔ `id="…"` on `EmptySwatch`)
16
+
- ✅ Wrapping native `<label>…</label>`
17
+
- ✅ `Tooltip` parent with `relationship="label"`
18
+
- ✅ Text content child (e.g., `<EmptySwatch>None</EmptySwatch>`)
19
+
- ❌ `Field` parent (not allowed for `EmptySwatch`)
20
+
- ❌ Container-only label (e.g., only the surrounding `SwatchPicker` is labelled)
21
+
22
+
## Ways to fix
23
+
24
+
- Add `aria-label`/`aria-labelledby` to `EmptySwatch`.
25
+
- Use `<label htmlFor="…">` + `id="…"` on `EmptySwatch`.
26
+
- Wrap in a native `<label>` or `Tooltip (relationship="label")`.
27
+
- Provide meaningful text **as the child** of `EmptySwatch`.
28
+
29
+
## Rule Details
30
+
31
+
This rule ensures `EmptySwatch` is labelled using **allowed** mechanisms.
32
+
33
+
### Examples of **incorrect** code
34
+
35
+
```jsx
36
+
// No label
37
+
<SwatchPicker>
38
+
<EmptySwatch value="none"/>
39
+
</SwatchPicker>
40
+
```
41
+
42
+
```jsx
43
+
// Container-only label: EmptySwatch itself is unnamed
# Accessibility: ImageSwatch must have an accessible name via aria-label, Tooltip, aria-labelledby, etc. (`@microsoft/fluentui-jsx-a11y/imageswatch-needs-labelling`)
2
+
3
+
💼 This rule is enabled in the ✅ `recommended` config.
4
+
5
+
<!-- end auto-generated rule header -->
6
+
7
+
All interactive elements must have an accessible name.
8
+
9
+
`ImageSwatch` without a supported label lacks an accessible name for assistive technology users.
10
+
11
+
## Allowed labelling strategies
12
+
13
+
- ✅ `aria-label`**on `ImageSwatch`**
14
+
- ✅ `aria-labelledby`**on `ImageSwatch`**
15
+
- ✅ Wrapping native `<label>…</label>`
16
+
- ✅ `Tooltip` parent with `relationship="label"` (e.g., from Fluent UI)
17
+
- ❌ `Field` parent (not allowed for `ImageSwatch`)
18
+
- ❌ `htmlFor`/`id` (not allowed for `ImageSwatch`)
19
+
- ❌ Text content child (not allowed)
20
+
- ❌ Container-only label (e.g., only the surrounding `SwatchPicker` is labelled)
21
+
22
+
## Ways to fix
23
+
24
+
- Add `aria-label` or `aria-labelledby`**directly** to `ImageSwatch`.
25
+
- Wrap the swatch in a native `<label>…</label>` with descriptive text.
26
+
- Wrap in a `Tooltip` with `relationship="label"` and meaningful `content`.
27
+
28
+
## Rule Details
29
+
30
+
This rule ensures `ImageSwatch` receives a name via **supported** mechanisms.
31
+
32
+
### Examples of **incorrect** code
33
+
34
+
```jsx
35
+
// No label at all
36
+
<SwatchPicker>
37
+
<ImageSwatch src="/none.png" value="none"/>
38
+
</SwatchPicker>
39
+
```
40
+
41
+
```jsx
42
+
// Container-only label: ImageSwatch itself is unnamed
0 commit comments