@@ -31,7 +31,7 @@ export class NavigationPlugin extends KalturaPlayer.core.BasePlugin {
31
31
private _activeCuePointsMap : HighlightedMap ;
32
32
private _captionMap : Map < string , Array < ItemData > > = new Map ( ) ;
33
33
private _activeCaptionMapId : string = '' ;
34
- private _navigationComponentRef : Navigation | null = null ;
34
+ private _pluginButtonRef : HTMLButtonElement | null = null ;
35
35
36
36
private _player : KalturaPlayerTypes . Player ;
37
37
private _navigationPanel = - 1 ;
@@ -259,6 +259,13 @@ export class NavigationPlugin extends KalturaPlayer.core.BasePlugin {
259
259
}
260
260
} ;
261
261
262
+ private _handleClose = ( e : OnClickEvent , byKeyboard : boolean ) => {
263
+ if ( byKeyboard ) {
264
+ this . _pluginButtonRef ?. focus ( ) ;
265
+ }
266
+ this . _deactivatePlugin ( ) ;
267
+ } ;
268
+
262
269
private _createNavigationPlugin = ( ) => {
263
270
if ( Math . max ( this . _navigationPanel , this . _navigationIcon ) > 0 ) {
264
271
this . logger . warn ( 'navigation plugin already initialized' ) ;
@@ -270,10 +277,7 @@ export class NavigationPlugin extends KalturaPlayer.core.BasePlugin {
270
277
panelComponent : ( ) => {
271
278
return (
272
279
< Navigation
273
- ref = { node => {
274
- this . _navigationComponentRef = node ;
275
- } }
276
- onClose = { this . _deactivatePlugin }
280
+ onClose = { this . _handleClose }
277
281
data = { this . _data }
278
282
onItemClicked = { this . _seekTo }
279
283
isLoading = { this . _isLoading }
@@ -296,7 +300,7 @@ export class NavigationPlugin extends KalturaPlayer.core.BasePlugin {
296
300
svgIcon : { path : icons . PLUGIN_ICON , viewBox : `0 0 ${ icons . BigSize } ${ icons . BigSize } ` } ,
297
301
onClick : this . _handleClickOnPluginIcon as ( ) => void ,
298
302
component : ( ) => {
299
- return < PluginButton isActive = { this . _isPluginActive ( ) } onClick = { this . _handleClickOnPluginIcon } /> ;
303
+ return < PluginButton isActive = { this . _isPluginActive ( ) } onClick = { this . _handleClickOnPluginIcon } setRef = { this . _setPluginButtonRef } /> ;
300
304
}
301
305
} ) as number ;
302
306
@@ -370,13 +374,17 @@ export class NavigationPlugin extends KalturaPlayer.core.BasePlugin {
370
374
return this . sidePanelsManager ! . isItemActive ( this . _navigationPanel ) ;
371
375
} ;
372
376
377
+ private _setPluginButtonRef = ( ref : HTMLButtonElement ) => {
378
+ this . _pluginButtonRef = ref ;
379
+ } ;
380
+
373
381
reset ( ) : void {
374
382
if ( Math . max ( this . _navigationPanel , this . _navigationIcon ) > 0 ) {
375
383
this . sidePanelsManager ! . remove ( this . _navigationPanel ) ;
376
384
this . upperBarManager ! . remove ( this . _navigationIcon ) ;
377
385
this . _navigationPanel = - 1 ;
378
386
this . _navigationIcon = - 1 ;
379
- this . _navigationComponentRef = null ;
387
+ this . _pluginButtonRef = null ;
380
388
}
381
389
this . _activeCuePointsMap = this . _getDefaultActiveCuePointsMap ( ) ;
382
390
this . _activeCaptionMapId = '' ;
0 commit comments