Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(Progress): add aria props (#1681) (#1787)
pass aria-valuetext , aria-labelledby to Progress. Set default min value.
  • Loading branch information
yogmel committed Jun 22, 2020
1 parent c0e5483 commit 93f171d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/lib/Components/ProgressPage.js
Expand Up @@ -43,6 +43,10 @@ export default class ProgressPage extends React.Component {
PropTypes.string,
PropTypes.number,
]),
min: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
max: PropTypes.oneOf([
PropTypes.string,
PropTypes.number,
Expand All @@ -51,7 +55,9 @@ export default class ProgressPage extends React.Component {
striped: PropTypes.bool,
color: PropTypes.string,
className: PropTypes.string,
barClassName: PropTypes.string // used to add class to the inner progress-bar element
barClassName: PropTypes.string, // used to add class to the inner progress-bar element
barAriaValueText: PropTypes.string,
barAriaLabelledBy: PropTypes.string,
};
Progress.defaultProps = {
Expand Down
14 changes: 13 additions & 1 deletion src/Progress.js
Expand Up @@ -12,6 +12,10 @@ const propTypes = {
PropTypes.string,
PropTypes.number,
]),
min: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
max: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
Expand All @@ -23,11 +27,14 @@ const propTypes = {
barClassName: PropTypes.string,
cssModule: PropTypes.object,
style: PropTypes.object,
barAriaValueText: PropTypes.string,
barAriaLabelledBy: PropTypes.string,
};

const defaultProps = {
tag: 'div',
value: 0,
min: 0,
max: 100,
style: {},
};
Expand All @@ -39,6 +46,7 @@ const Progress = (props) => {
barClassName,
cssModule,
value,
min,
max,
animated,
striped,
Expand All @@ -47,6 +55,8 @@ const Progress = (props) => {
multi,
tag: Tag,
style,
barAriaValueText,
barAriaLabelledBy,
...attributes
} = props;

Expand Down Expand Up @@ -74,8 +84,10 @@ const Progress = (props) => {
}}
role="progressbar"
aria-valuenow={value}
aria-valuemin="0"
aria-valuemin={min}
aria-valuemax={max}
aria-valuetext={barAriaValueText}
aria-labelledby={barAriaLabelledBy}
children={children}
/>
);
Expand Down

0 comments on commit 93f171d

Please sign in to comment.