diff --git a/api-generator/components/chart.js b/api-generator/components/chart.js index 76c2c7ae49..121ea9db1c 100644 --- a/api-generator/components/chart.js +++ b/api-generator/components/chart.js @@ -52,6 +52,12 @@ const ChartProps = [ type: 'string', default: 'null', description: 'Style class of the element.' + }, + { + name: 'ariaLabel', + type: 'string', + default: 'options.plugins.title.text', + description: ' ARIA label for the chart canvas. Defaults to options.plugins.title.text if available.' } ]; diff --git a/components/lib/chart/Chart.js b/components/lib/chart/Chart.js index 8505d4ef5a..1179c03344 100644 --- a/components/lib/chart/Chart.js +++ b/components/lib/chart/Chart.js @@ -84,10 +84,12 @@ const PrimeReactChart = React.memo( const otherProps = ChartBase.getOtherProps(props); const className = classNames('p-chart', props.className); const style = Object.assign({ width: props.width, height: props.height }, props.style); + const title = props.options && props.options.plugins && props.options.plugins.title && props.options.plugins.title.text; + const ariaLabel = props.ariaLabel || title; return (