Skip to content

Commit

Permalink
fix(ADA-1468): Holding Enter on Player Controls Causes Flashing (#924)
Browse files Browse the repository at this point in the history
Issue:
Pressing enter on full screen button go to onClick instead of using handleKeydown

Fix:
Adding onKeyDown on the button

Resolves ADA-1468
  • Loading branch information
Tzipi-kaltura authored Aug 15, 2024
1 parent 28b456a commit 328d751
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/fullscreen/fullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ class Fullscreen extends Component<
* @returns {void}
* @memberof Fullscreen
*/
handleKeydown(event: KeyboardEvent): void {
handleKeydown = (event: KeyboardEvent): void => {
switch (event.keyCode) {
case KeyMap.ENTER:
event.preventDefault();
if (!event.repeat) {
this.toggleFullscreen();
}
Expand All @@ -117,7 +118,7 @@ class Fullscreen extends Component<
default:
break;
}
}
};
/**
* toggle fullscreen based on current fullscreen state in store
*
Expand Down Expand Up @@ -145,6 +146,7 @@ class Fullscreen extends Component<
tabIndex="0"
aria-label={this.props.isInFullscreen ? this.props.fullscreenExitText : this.props.fullscreenText}
className={this.props.isInFullscreen ? [style.controlButton, style.isFullscreen].join(' ') : style.controlButton}
onKeyDown={this.handleKeydown}
onClick={this.toggleFullscreen}
>
<Icon type={IconType.Maximize} />
Expand Down

0 comments on commit 328d751

Please sign in to comment.