Skip to content

Commit

Permalink
feat(Progress): progress accessibility support
Browse files Browse the repository at this point in the history
  • Loading branch information
tao1991123 committed Dec 29, 2018
1 parent 8275c91 commit 524e97f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/progress/view/progress-circle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ export default class Circle extends Component {
});

return (
<div {...others} className={wrapCls} dir={rtl ? 'rtl' : undefined}>
<div
className={wrapCls}
dir={rtl ? 'rtl' : undefined}
tabIndex="0"
role="progressbar"
aria-valuenow={percent}
aria-valuemin="0"
aria-valuemax="100"
{...others}>
<svg className={`${prefix}progress-circle-container`} viewBox={viewBox}>
<path className={`${prefix}progress-circle-underlay`} d={underlayPath} fillOpacity="0" ref={this._underlayRefHandler} />
<path
Expand Down
13 changes: 12 additions & 1 deletion src/progress/view/progress-line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export default class Line extends React.PureComponent {
textRender: PropTypes.func,
color: PropTypes.string,
rtl: PropTypes.bool,
prefix: PropTypes.string,
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
};

render() {
Expand All @@ -22,6 +24,7 @@ export default class Line extends React.PureComponent {
textRender, className, rtl,
...others } = this.props;


const suffixText = textRender(percent, {rtl});

const wrapCls = classNames({
Expand All @@ -42,7 +45,15 @@ export default class Line extends React.PureComponent {
const lineStyle = { width: `${percent}%`, backgroundColor: color };

return (
<div {...others} className={wrapCls} dir={rtl ? 'rtl' : undefined}>
<div
dir={rtl ? 'rtl' : undefined}
tabIndex="0"
role="progressbar"
aria-valuenow={percent}
aria-valuemin="0"
aria-valuemax="100"
{...others}
className={wrapCls}>
<div className={`${prefix}progress-line-container`}>
<div className={`${prefix}progress-line-underlay`}>
<div className={lineCls} style={lineStyle}></div>
Expand Down

0 comments on commit 524e97f

Please sign in to comment.