-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per-component accessibility doc updates (#1388)
# Pull Request ## 🤨 Rationale Resolves #1090 In [PR discussion on #1272](#1272 (comment)), we decided that the per-component accessibility notes would be better documented in Storybook (by the other component docs), instead of in accessibility.md. Resolves #1393 ## 👩💻 Implementation For components with accessibility notes not already documented in Storybook: - Create an mdx docs page for them, if it wasn't already present. Based on PR comments on the recent PR by Jesse, I think this is the general direction we're going for component docs. - Add a Usage Docs / Accessibility section at the bottom, and add the notes from accessibility.md. The button/spinner mdx have these sections, so again following the existing patterns. ## 🧪 Testing Manual verification in Storybook. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
- Loading branch information
Showing
17 changed files
with
139 additions
and
43 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-f0feaca4-ded2-4e5c-bc9c-97420f643497.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Update component accessibility docs in Storybook", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"dependentChangeType": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/nimble-components/src/anchor-button/tests/anchor-button.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
Controls, | ||
DocsStory, | ||
Meta, | ||
Stories, | ||
Title, | ||
Description | ||
} from '@storybook/blocks'; | ||
import ContentHiddenDocs from '../../patterns/button/tests/content-hidden-docs.mdx'; | ||
import * as anchorButtonStories from './anchor-button.stories'; | ||
|
||
<Meta of={anchorButtonStories} /> | ||
|
||
<Title of={anchorButtonStories} /> | ||
<Description of={anchorButtonStories} /> | ||
|
||
<DocsStory of={anchorButtonStories.outlineAnchorButton} expanded={false} /> | ||
<Controls of={anchorButtonStories.outlineAnchorButton} /> | ||
|
||
# Usage Docs | ||
|
||
## Accessibility | ||
|
||
<ContentHiddenDocs buttonElement="nimble-anchor-button" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
Meta, | ||
Controls, | ||
DocsStory, | ||
Title, | ||
Description | ||
} from '@storybook/blocks'; | ||
import * as iconsStories from './icons.stories'; | ||
|
||
<Meta of={iconsStories} /> | ||
|
||
<Title of={iconsStories} /> | ||
<Description of={iconsStories} /> | ||
|
||
<DocsStory of={iconsStories.icons} expanded={false} /> | ||
<Controls of={iconsStories.icons} /> | ||
|
||
# Usage Docs | ||
|
||
<br /> | ||
|
||
## Accessibility | ||
|
||
When using an icon standalone, the `title` attribute should usually be set, to provide accessible text (which will also show as a tooltip). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/nimble-components/src/menu-button/tests/menu-button.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
Controls, | ||
DocsStory, | ||
Meta, | ||
Stories, | ||
Title, | ||
Description | ||
} from '@storybook/blocks'; | ||
import ContentHiddenDocs from '../../patterns/button/tests/content-hidden-docs.mdx'; | ||
import * as menuButtonStories from './menu-button.stories'; | ||
|
||
<Meta of={menuButtonStories} /> | ||
<Title of={menuButtonStories} /> | ||
<Description of={menuButtonStories} /> | ||
|
||
<DocsStory of={menuButtonStories.outlineButton} expanded={false} /> | ||
<Controls of={menuButtonStories.outlineButton} /> | ||
|
||
# Usage Docs | ||
|
||
## Accessibility | ||
|
||
<ContentHiddenDocs buttonElement="nimble-menu-button" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/nimble-components/src/patterns/button/tests/content-hidden-docs.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
When using the <code>{props.buttonElement}</code> with only an icon: | ||
|
||
- Add the <code>{props.contentHiddenAttribute ?? 'content-hidden'}</code> | ||
attribute and provide text content within the button even though it will not be visible on the screen. The button will use the text content | ||
to configure the appropriate ARIA attributes internally to ensure the button is adequately accessible with a screen reader. | ||
- Consider providing a tooltip to provide extra information (with the `title` attribute). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/nimble-components/src/toggle-button/tests/toggle-button.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
Controls, | ||
DocsStory, | ||
Meta, | ||
Stories, | ||
Title, | ||
Description | ||
} from '@storybook/blocks'; | ||
import ContentHiddenDocs from '../../patterns/button/tests/content-hidden-docs.mdx'; | ||
import * as toggleButtonStories from './toggle-button.stories'; | ||
|
||
<Meta of={toggleButtonStories} /> | ||
<Title of={toggleButtonStories} /> | ||
<Description of={toggleButtonStories} /> | ||
|
||
<DocsStory of={toggleButtonStories.outlineButton} expanded={false} /> | ||
<Controls of={toggleButtonStories.outlineButton} /> | ||
|
||
# Usage Docs | ||
|
||
## Accessibility | ||
|
||
<ContentHiddenDocs buttonElement="nimble-toggle-button" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters