@@ -979,27 +979,27 @@ export class MenuBar extends Disposable {
979979 const actualMenuIndex = menuIndex >= this . numMenusShown ? MenuBar . OVERFLOW_INDEX : menuIndex ;
980980 const customMenu = actualMenuIndex === MenuBar . OVERFLOW_INDEX ? this . overflowMenu : this . menus [ actualMenuIndex ] ;
981981
982- if ( ! customMenu . actions || ! customMenu . buttonElement ) {
982+ if ( ! customMenu . actions || ! customMenu . buttonElement || ! customMenu . titleElement ) {
983983 return ;
984984 }
985985
986986 const menuHolder = $ ( 'div.menubar-menu-items-holder' , { 'title' : '' } ) ;
987987
988988 customMenu . buttonElement . classList . add ( 'open' ) ;
989989
990- const buttonBoundingRect = customMenu . buttonElement . getBoundingClientRect ( ) ;
991- const buttonBoundingRectZoom = DOM . getDomNodeZoomLevel ( customMenu . buttonElement ) ;
990+ const titleBoundingRect = customMenu . titleElement . getBoundingClientRect ( ) ;
991+ const titleBoundingRectZoom = DOM . getDomNodeZoomLevel ( customMenu . titleElement ) ;
992992
993993 if ( this . options . compactMode === Direction . Right ) {
994- menuHolder . style . top = `${ buttonBoundingRect . top } px` ;
995- menuHolder . style . left = `${ buttonBoundingRect . left + this . container . clientWidth } px` ;
994+ menuHolder . style . top = `${ titleBoundingRect . top } px` ;
995+ menuHolder . style . left = `${ titleBoundingRect . left + this . container . clientWidth } px` ;
996996 } else if ( this . options . compactMode === Direction . Left ) {
997- menuHolder . style . top = `${ buttonBoundingRect . top } px` ;
997+ menuHolder . style . top = `${ titleBoundingRect . top } px` ;
998998 menuHolder . style . right = `${ this . container . clientWidth } px` ;
999999 menuHolder . style . left = 'auto' ;
10001000 } else {
1001- menuHolder . style . top = `${ buttonBoundingRect . bottom * buttonBoundingRectZoom } px` ;
1002- menuHolder . style . left = `${ buttonBoundingRect . left * buttonBoundingRectZoom } px` ;
1001+ menuHolder . style . top = `${ titleBoundingRect . bottom * titleBoundingRectZoom } px` ;
1002+ menuHolder . style . left = `${ titleBoundingRect . left * titleBoundingRectZoom } px` ;
10031003 }
10041004
10051005 customMenu . buttonElement . appendChild ( menuHolder ) ;
0 commit comments