From cd7e285f29883f208f68d37f670989b7d689e15a Mon Sep 17 00:00:00 2001 From: SudoSaysWhat Date: Fri, 19 Jul 2024 14:03:55 +0300 Subject: [PATCH 1/3] fix(ADA-1275): When user focuses the player he will be able to play/pause with "space" key --- src/components/play-pause/play-pause.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/play-pause/play-pause.tsx b/src/components/play-pause/play-pause.tsx index 7c5d4c5f2..8c63e3d28 100644 --- a/src/components/play-pause/play-pause.tsx +++ b/src/components/play-pause/play-pause.tsx @@ -63,6 +63,8 @@ class PlayPause extends Component { this._playPauseButtonRef?.focus(); }); }); + const myPlayerContainer = document.querySelector('.kaltura-player-container'); + eventManager.listen(myPlayerContainer,'keydown', this.handleSpaceKey); } /** @@ -77,6 +79,13 @@ class PlayPause extends Component { this.props.notifyClick(); }; + handleSpaceKey = (event) => { + if (event.code === 'Space') { + this.togglePlayPause(); + event.preventDefault(); + } + } + /** * render component * From 0da241f275ea9814c6d7df71eb4363e204749dce Mon Sep 17 00:00:00 2001 From: SudoSaysWhat Date: Thu, 1 Aug 2024 13:01:24 +0300 Subject: [PATCH 2/3] ADA-1275-Selected according to the current player ID --- src/components/play-pause/play-pause.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/play-pause/play-pause.tsx b/src/components/play-pause/play-pause.tsx index 8c63e3d28..ce4ec7c67 100644 --- a/src/components/play-pause/play-pause.tsx +++ b/src/components/play-pause/play-pause.tsx @@ -63,8 +63,9 @@ class PlayPause extends Component { this._playPauseButtonRef?.focus(); }); }); - const myPlayerContainer = document.querySelector('.kaltura-player-container'); - eventManager.listen(myPlayerContainer,'keydown', this.handleSpaceKey); + const targetId: HTMLDivElement | Document = (document.getElementById(this.props.player.config.targetId) as HTMLDivElement) || document; + //const myPlayerContainer = document.querySelector('.kaltura-player-container'); + eventManager.listen(targetId,'keydown', this.handleSpaceKey); } /** From f1a4ad1830fd2d38dcebc73641216d2aca041a3e Mon Sep 17 00:00:00 2001 From: SudoSaysWhat Date: Thu, 1 Aug 2024 13:02:31 +0300 Subject: [PATCH 3/3] ADA-1275- Removed comment --- src/components/play-pause/play-pause.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/play-pause/play-pause.tsx b/src/components/play-pause/play-pause.tsx index ce4ec7c67..6488a9b22 100644 --- a/src/components/play-pause/play-pause.tsx +++ b/src/components/play-pause/play-pause.tsx @@ -64,7 +64,6 @@ class PlayPause extends Component { }); }); const targetId: HTMLDivElement | Document = (document.getElementById(this.props.player.config.targetId) as HTMLDivElement) || document; - //const myPlayerContainer = document.querySelector('.kaltura-player-container'); eventManager.listen(targetId,'keydown', this.handleSpaceKey); }