Skip to content

Commit

Permalink
fix(slider): add label to slider
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack committed Dec 10, 2020
1 parent 11be076 commit 7798b0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react/src/components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export default class Slider extends PureComponent {

const { value, left } = this.state;

const labelId = `${id}-label`;
const labelClasses = classNames(`${prefix}--label`, {
[`${prefix}--label--disabled`]: disabled,
});
Expand Down Expand Up @@ -536,7 +537,7 @@ export default class Slider extends PureComponent {

return (
<div className={`${prefix}--form-item`}>
<label htmlFor={id} className={labelClasses}>
<label htmlFor={id} className={labelClasses} id={labelId}>
{labelText}
</label>
<div className={`${prefix}--slider-container`}>
Expand All @@ -560,6 +561,7 @@ export default class Slider extends PureComponent {
role="slider"
id={id}
tabIndex={0}
aria-labelledby={labelId}
aria-valuemax={max}
aria-valuemin={min}
aria-valuenow={value}
Expand Down

0 comments on commit 7798b0c

Please sign in to comment.