@@ -52,27 +52,27 @@ export default abstract class HeaderMenu {
5252 $ ( this . menu . node ) . off ( 'keydown.HeaderMenu' , '.dropdown-menu-search input' , this . handleKeydownEvent )
5353 }
5454
55- protected getMenuPosition ( $notebookCell , $trigger ) {
56- const $cell = $trigger . parent ( ) ;
55+ protected getMenuPosition ( $container : any , $trigger : any ) {
5756 const rectObject = $trigger [ 0 ] . getBoundingClientRect ( ) ;
57+ const containerRectObj = $container [ 0 ] . getBoundingClientRect ( ) ;
5858 const pageHeight = window . innerHeight || document . documentElement . clientHeight ;
5959 const pixelsBelowViewport = Math . ceil ( $ ( this . menu . contentNode ) . height ( ) + rectObject . bottom - pageHeight ) ;
60- const triggerHeight = $trigger . height ( ) || 20 ;
60+ const triggerHeight = rectObject . height || 20 ;
6161
6262 return {
63- top : ( $cell . offset ( ) . top - $notebookCell . offset ( ) . top + triggerHeight - ( pixelsBelowViewport > 0 ? pixelsBelowViewport : 0 ) ) ,
64- left : $cell . offset ( ) . left - $notebookCell . offset ( ) . left + ( pixelsBelowViewport > 0 ? triggerHeight : 0 )
63+ top : rectObject . bottom - containerRectObj . top + triggerHeight - ( pixelsBelowViewport > 0 ? pixelsBelowViewport : 0 ) ,
64+ left : rectObject . left + ( pixelsBelowViewport > 0 ? triggerHeight : 0 )
6565 } ;
6666 }
6767
68- open ( $notebookCell : any , $trigger : any , submenuIndex ?: number ) : void {
69- Widget . attach ( this . menu , $notebookCell [ 0 ] ) ;
68+ open ( $container : any , $trigger : any , submenuIndex ?: number ) : void {
69+ Widget . attach ( this . menu , $container [ 0 ] ) ;
7070 this . menu . node . style . top = null ;
7171 this . menu . node . style . bottom = '0px' ;
7272 this . menu . addClass ( 'open' ) ;
7373 this . menu . show ( ) ;
7474
75- const menuPosition = this . getMenuPosition ( $notebookCell , $trigger ) ;
75+ const menuPosition = this . getMenuPosition ( $container , $trigger ) ;
7676 this . menu . node . style . top = menuPosition . top + 'px' ;
7777 this . menu . node . style . left = menuPosition . left + 'px' ;
7878 this . menu . node . style . bottom = null ;
@@ -132,7 +132,7 @@ export default abstract class HeaderMenu {
132132 if ( menuItem . shortcut ) {
133133 this . commands . addKeyBinding ( {
134134 keys : [ menuItem . shortcut ] ,
135- selector : '.cell ' ,
135+ selector : 'body ' ,
136136 command : menuItem . title
137137 } ) ;
138138 }
0 commit comments