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

Commit f8860db

Browse files
committed
add accessible name for custom loader
1 parent b1015de commit f8860db

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/BlockUi.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class BlockUi extends Component {
157157
{blocking &&
158158
<div tabIndex="0" onKeyUp={this.tabbedUpTop} onKeyDown={this.tabbedDownTop} ref={this.setTopFocus}>
159159
<div className="sr-only">
160-
{message || React.isValidElement(Loader) ? Loader : ariaLabel}
160+
{message || ariaLabel}
161161
</div>
162162
</div>}
163163
{renderChilds && children}
@@ -174,8 +174,10 @@ class BlockUi extends Component {
174174
style={{ top: keepInView ? this.state.top : undefined }}
175175
>
176176
<div className="block-ui-message">
177-
{message}
178-
{React.isValidElement(Loader) ? Loader : <Loader ariaLabel={ariaLabel} />}
177+
{message || <span className="sr-only">{ariaLabel}</span>}
178+
<div aria-hidden>
179+
{React.isValidElement(Loader) ? Loader : <Loader/>}
180+
</div>
179181
</div>
180182
</div>
181183
</div>

src/Loader.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
3-
function Loader({ ariaLabel }) {
2+
3+
function Loader() {
44
return (
55
<div className="loading-indicator">
6-
<span className="sr-only">{ariaLabel}</span>
7-
<span aria-hidden className="loading-bullet">&bull;</span>{' '}
8-
<span aria-hidden className="loading-bullet">&bull;</span>{' '}
9-
<span aria-hidden className="loading-bullet">&bull;</span>
6+
<span className="loading-bullet">&bull;</span>{' '}
7+
<span className="loading-bullet">&bull;</span>{' '}
8+
<span className="loading-bullet">&bull;</span>
109
</div>
1110
);
1211
}
1312

14-
Loader.propTypes = {
15-
ariaLabel: PropTypes.string,
16-
};
17-
1813
export default Loader;

0 commit comments

Comments
 (0)