Skip to content

Commit d99a896

Browse files
fix(FEC-13973): volume control a11y changes (#888)
### Description of the Changes Use opacity to hide/show volume control slider **Issue:** **Fix:** resolves: https://kaltura.atlassian.net/browse/FEC-13973
1 parent f5ac020 commit d99a896

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/components/volume/_volume.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
&.hover {
77
.volume-control-bar {
88
display: block !important;
9+
opacity: 1;
910
}
1011
}
1112

@@ -28,6 +29,7 @@
2829
&.dragging-active {
2930
.volume-control-bar {
3031
display: block;
32+
opacity: 1;
3133
}
3234
}
3335

@@ -70,7 +72,7 @@
7072
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.3);
7173
background-color: #333333;
7274
padding: 6px;
73-
display: none;
75+
opacity: 0;
7476

7577
&:before {
7678
position: absolute;

src/components/volume/volume.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class Volume extends Component<any, any> {
209209
* @returns {void}
210210
* @memberof Volume
211211
*/
212-
handleKeydown(event: KeyboardEvent): void {
212+
handleKeydown(event: KeyboardEvent, preventMute = false): void {
213213
const {player} = this.props;
214214
/**
215215
* Change volume operations.
@@ -246,7 +246,9 @@ class Volume extends Component<any, any> {
246246
break;
247247
case KeyMap.ENTER:
248248
case KeyMap.SPACE:
249-
this.toggleMute();
249+
if (!preventMute) {
250+
this.toggleMute();
251+
}
250252
break;
251253
default:
252254
break;
@@ -419,7 +421,7 @@ class Volume extends Component<any, any> {
419421
default:
420422
event.preventDefault();
421423
event.stopPropagation();
422-
this.handleKeydown(event);
424+
this.handleKeydown(event, true);
423425
break;
424426
}
425427
};
@@ -447,8 +449,7 @@ class Volume extends Component<any, any> {
447449
ref={c => (c ? (this._volumeControlElement = c) : undefined)}
448450
className={controlButtonClasses}
449451
onMouseOver={this.onMouseOver}
450-
onMouseOut={this.onMouseOut}
451-
>
452+
onMouseOut={this.onMouseOut}>
452453
<Tooltip label={this.props.volumeLabel} type={this.props.toolTipType ? this.props.toolTipType : ToolTipType.Left}>
453454
<Button
454455
tabIndex="0"
@@ -457,9 +458,7 @@ class Volume extends Component<any, any> {
457458
className={style.controlButton}
458459
onMouseUp={this.toggleMute}
459460
onTouchEnd={this.onTouchEnd}
460-
onKeyDown={this.onKeyDown}
461-
onFocus={this.onFocus}
462-
>
461+
onKeyDown={this.onKeyDown}>
463462
<Icon type={IconType.VolumeBase} />
464463
<Icon type={IconType.VolumeWaves} />
465464
<Icon type={IconType.VolumeMute} />
@@ -471,17 +470,16 @@ class Volume extends Component<any, any> {
471470
aria-label={this.props.sliderAriaLabel}
472471
onKeyDown={this.onProgressBarKeyDown}
473472
className={style.volumeControlBar}
473+
onFocus={this.onFocus}
474474
role="slider"
475475
aria-valuemin={0}
476476
aria-valuemax={100}
477477
aria-valuenow={player.volume * 100}
478-
aria-valuetext={`${player.volume * 100}% volume ${player.muted ? 'muted' : ''}`}
479-
>
478+
aria-valuetext={`${player.volume * 100}% volume ${player.muted ? 'muted' : ''}`}>
480479
<div
481480
className={style.bar}
482481
ref={c => (c ? (this._volumeProgressBarElement = c) : undefined)}
483-
onMouseDown={this.onVolumeProgressBarMouseDown}
484-
>
482+
onMouseDown={this.onVolumeProgressBarMouseDown}>
485483
<div className={style.progress} style={{height: this.getVolumeProgressHeight()}} />
486484
</div>
487485
</div>

0 commit comments

Comments
 (0)