Skip to content
This repository was archived by the owner on Feb 21, 2023. It is now read-only.

Commit 01f160c

Browse files
Merge pull request #67 from Availity/blockui-aria-label
2 parents beddcf5 + 8d03ee2 commit 01f160c

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

docs/lib/examples/BlockUi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class Example extends React.Component {
2020
render() {
2121
return (
2222
<div>
23-
<BlockUi tag="div" blocking={this.state.blocking}>
23+
<BlockUi tag="div" blocking={this.state.blocking} ariaLabel="loading results">
2424
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
2525
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
2626
</BlockUi>

src/BlockUi.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class BlockUi extends Component {
150150

151151
const classes = blocking ? `block-ui ${className}` : className;
152152
const renderChilds = !blocking || renderChildren;
153+
const { ariaLabel = 'loading' } = attributes;
153154

154155
return (
155156
<Tag {...attributes} className={classes} aria-busy={blocking}>
@@ -170,7 +171,7 @@ class BlockUi extends Component {
170171
>
171172
<div className="block-ui-message">
172173
{message}
173-
{React.isValidElement(Loader) ? Loader : <Loader />}
174+
{React.isValidElement(Loader) ? Loader : <Loader ariaLabel={ariaLabel} />}
174175
</div>
175176
</div>
176177
</div>
@@ -201,6 +202,7 @@ BlockUi.propTypes = {
201202
PropTypes.func,
202203
PropTypes.shape({ $$typeof: PropTypes.symbol, render: PropTypes.func }),
203204
]),
205+
ariaLabel: PropTypes.string,
204206
};
205207
BlockUi.defaultProps = defaultProps;
206208

src/Loader.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import React from 'react';
2-
3-
function Loader() {
2+
import PropTypes from 'prop-types';
3+
function Loader({ ariaLabel }) {
44
return (
5-
<div className="loading-indicator">
6-
<span className="loading-bullet">&bull;</span>{' '}
7-
<span className="loading-bullet">&bull;</span>{' '}
8-
<span className="loading-bullet">&bull;</span>
5+
<div className="loading-indicator" aria-label={ariaLabel}>
6+
<span aria-hidden="true" className="loading-bullet">&bull;</span>{' '}
7+
<span aria-hidden="true" className="loading-bullet">&bull;</span>{' '}
8+
<span aria-hidden="true" className="loading-bullet">&bull;</span>
99
</div>
1010
);
1111
}
1212

13+
Loader.propTypes = {
14+
ariaLabel: PropTypes.string
15+
}
16+
1317
export default Loader;

0 commit comments

Comments
 (0)