Skip to content
This repository was archived by the owner on Oct 19, 2021. It is now read-only.

Commit f487cf9

Browse files
paschalidiasudoh
authored andcommitted
fix(Loading): adds aria-label and description property to component (#2252)
* fix: adds property description * fix: adds description property to aria-label * fix: typo * fix: typo
1 parent 2335c44 commit f487cf9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/components/Loading/Loading.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,29 @@ export default class Loading extends React.Component {
3434
* Specify whether you would like the small variant of <Loading>
3535
*/
3636
small: PropTypes.bool,
37+
38+
/**
39+
* Specify an description that would be used to best describe the loading state
40+
*/
41+
description: PropTypes.string,
3742
};
3843

3944
static defaultProps = {
4045
active: true,
4146
withOverlay: true,
4247
small: false,
48+
description: 'Active loading indicator',
4349
};
4450

4551
render() {
46-
const { active, className, withOverlay, small, ...other } = this.props;
52+
const {
53+
active,
54+
className,
55+
withOverlay,
56+
small,
57+
description,
58+
...other
59+
} = this.props;
4760

4861
const loadingClasses = classNames(`${prefix}--loading`, className, {
4962
[`${prefix}--loading--small`]: small,
@@ -57,6 +70,7 @@ export default class Loading extends React.Component {
5770
const loading = (
5871
<div
5972
{...other}
73+
aria-label={description}
6074
aria-live={active ? 'assertive' : 'off'}
6175
className={loadingClasses}>
6276
<svg className={`${prefix}--loading__svg`} viewBox="-75 -75 150 150">

0 commit comments

Comments
 (0)