patternfly-react
patternfly-react copied to clipboard
Add id prop to fix docs a11y violations
This adds an name
prop to Chart
in order to resolve the docs a11y violations, related to duplicate IDs.
Victory uses the name
prop as a prefix when creating child element IDs. This mimics that behavior so we don't need to create a new prop for ChartAxis
, ChartLegend
, etc.
https://github.com/patternfly/patternfly-react/issues/7675
Example:
When the top Chart
component uses name="chart1"
, axis tick label IDs are output as:
"chart1-ChartAxis-0-ChartLabel-0"
"chart1-ChartAxis-0-ChartLabel-1"
...
Dependent axis tick label IDs are output as:
"chart1-ChartAxis-1-ChartLabel-0"
"chart1-ChartAxis-1-ChartLabel-1"
...
And legend label IDs are output as:
"chart1-ChartLegend-ChartLabel-0"
"chart1-ChartLegend-ChartLabel-1"
...
This covers all the main Chart
components:
Chart
ChartAxis
ChartBullet
ChartDonut
ChartDonutUtilization
ChartDonutThreshold
ChartLegend
ChartPie
Screenshot from browser inspector:
Preview: https://patternfly-react-pr-7808.surge.sh
A11y report: https://patternfly-react-pr-7808-a11y.surge.sh
Your changes have been released in:
- [email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- [email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- @patternfly/[email protected]
- [email protected]
Thanks for your contribution! :tada: