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

Commit b1015de

Browse files
committed
add names to focusable elements
1 parent b29f5d0 commit b1015de

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

src/BlockUi.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ class BlockUi extends Component {
155155
return (
156156
<Tag {...attributes} className={classes} aria-busy={blocking}>
157157
{blocking &&
158-
<div tabIndex="0" onKeyUp={this.tabbedUpTop} onKeyDown={this.tabbedDownTop} ref={this.setTopFocus} />}
158+
<div tabIndex="0" onKeyUp={this.tabbedUpTop} onKeyDown={this.tabbedDownTop} ref={this.setTopFocus}>
159+
<div className="sr-only">
160+
{message || React.isValidElement(Loader) ? Loader : ariaLabel}
161+
</div>
162+
</div>}
159163
{renderChilds && children}
160164
{blocking &&
161165
<div className="block-ui-container"

src/Loader.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
function Loader({ ariaLabel }) {
44
return (
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>
5+
<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>
910
</div>
1011
);
1112
}
1213

1314
Loader.propTypes = {
14-
ariaLabel: PropTypes.string
15-
}
15+
ariaLabel: PropTypes.string,
16+
};
1617

1718
export default Loader;

src/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/* duplicate bootstrap sr-only class for users not using bootstrap/availity-uikit */
2+
.sr-only {
3+
position: absolute;
4+
width: 1px;
5+
height: 1px;
6+
padding: 0;
7+
margin: -1px;
8+
overflow: hidden;
9+
clip: rect(0,0,0,0);
10+
border: 0;/* 3 */
11+
}
112
.loading-indicator {
213
text-align: center;
314
}

0 commit comments

Comments
 (0)