Skip to content

Commit e482a2a

Browse files
authored
Fix #106 a11y on volume control (#110)
1 parent 5b6720b commit e482a2a

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/DefaultPlayer/DefaultPlayer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const DefaultPlayer = ({
8787
onChange={onVolumeChange}
8888
ariaLabelMute={copy.mute}
8989
ariaLabelUnmute={copy.unmute}
90+
ariaLabelVolume={copy.volume}
9091
{...video} />;
9192
case 'Captions':
9293
return video.textTracks && video.textTracks.length

src/DefaultPlayer/Volume/Volume.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styles from './Volume.css';
33
import VolumeOff from './../Icon/volume_off.svg';
44
import VolumeUp from './../Icon/volume_up.svg';
55

6-
export default ({ onChange, onClick, volume, muted, className, ariaLabelMute, ariaLabelUnmute }) => {
6+
export default ({ onChange, onClick, volume, muted, className, ariaLabelMute, ariaLabelUnmute, ariaLabelVolume }) => {
77
const volumeValue = muted
88
? 0
99
: +volume;
@@ -46,6 +46,7 @@ export default ({ onChange, onClick, volume, muted, className, ariaLabelMute, ar
4646
type="range"
4747
orient="vertical"
4848
onChange={onChange}
49+
aria-label={ariaLabelVolume}
4950
className={styles.input}
5051
value={volumeValue} />
5152
</div>

src/DefaultPlayer/Volume/Volume.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ describe('Volume', () => {
1212
component = shallow(
1313
<Volume
1414
ariaLabelMute="Mute"
15-
ariaLabelUnmute="Unmute" />
15+
ariaLabelUnmute="Unmute"
16+
ariaLabelVolume="Change volume" />
1617
);
1718
});
1819

@@ -41,6 +42,8 @@ describe('Volume', () => {
4142
.toEqual('0');
4243
expect(rangeInput.prop('max'))
4344
.toEqual('1');
45+
expect(rangeInput.prop('aria-label'))
46+
.toEqual('Change volume');
4447
});
4548

4649
it('triggers \'onClick\' prop when the button is clicked', () => {

src/DefaultPlayer/copy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const copy = {
33
pause: 'Pause video',
44
mute: 'Mute video',
55
unmute: 'Unmute video',
6+
volume: 'Change volume',
67
fullscreen: 'View video fullscreen',
78
seek: 'Seek video',
89
captions: 'Toggle captions'

0 commit comments

Comments
 (0)