Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(website): add a helper to generate common accessibility props
- Loading branch information
Showing
6 changed files
with
62 additions
and
114 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
import { ChartProperty, Flavor } from '../../types' | ||
|
||
export const role = (flavors: Flavor[]): ChartProperty => ({ | ||
key: 'role', | ||
group: 'Accessibility', | ||
type: 'string', | ||
required: false, | ||
help: 'Main element role attribute.', | ||
flavors, | ||
}) | ||
|
||
export const ariaLabel = (flavors: Flavor[]): ChartProperty => ({ | ||
key: 'ariaLabel', | ||
group: 'Accessibility', | ||
type: 'string', | ||
required: false, | ||
help: 'Main element [aria-label](https://www.w3.org/TR/wai-aria/#aria-label).', | ||
flavors, | ||
}) | ||
|
||
export const ariaLabelledBy = (flavors: Flavor[]): ChartProperty => ({ | ||
key: 'ariaLabelledBy', | ||
group: 'Accessibility', | ||
type: 'string', | ||
required: false, | ||
help: 'Main element [aria-labelledby](https://www.w3.org/TR/wai-aria/#aria-labelledby).', | ||
flavors, | ||
}) | ||
|
||
export const ariaDescribedBy = (flavors: Flavor[]): ChartProperty => ({ | ||
key: 'ariaDescribedBy', | ||
group: 'Accessibility', | ||
type: 'string', | ||
required: false, | ||
help: 'Main element [aria-describedby](https://www.w3.org/TR/wai-aria/#aria-describedby).', | ||
flavors, | ||
}) | ||
|
||
export const commonAccessibilityProps = (flavors: Flavor[]): ChartProperty[] => [ | ||
role(flavors), | ||
ariaLabel(flavors), | ||
ariaLabelledBy(flavors), | ||
ariaDescribedBy(flavors), | ||
] |
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