@@ -426,6 +426,9 @@ export interface ContextMenuOptions {
426426 y ?: number ;
427427}
428428
429+ const MENU_ITEM_HEIGHT_FOR_LOGGING = 20 ;
430+ const MENU_ITEM_WIDTH_FOR_LOGGING = 200 ;
431+
429432export class ContextMenu extends SubMenu {
430433 protected override contextMenu : this;
431434 private pendingTargets : unknown [ ] ;
@@ -545,14 +548,15 @@ export class ContextMenu extends SubMenu {
545548 if ( descriptor . type === 'checkbox' ) {
546549 VisualLogging . registerLoggable (
547550 descriptor , `${ VisualLogging . toggle ( ) . track ( { click : true } ) . context ( descriptor . jslogContext ) } ` ,
548- parent || descriptors ) ;
551+ parent || descriptors , new DOMRect ( 0 , 0 , MENU_ITEM_WIDTH_FOR_LOGGING , MENU_ITEM_HEIGHT_FOR_LOGGING ) ) ;
549552 } else if ( descriptor . type === 'item' ) {
550553 VisualLogging . registerLoggable (
551554 descriptor , `${ VisualLogging . action ( ) . track ( { click : true } ) . context ( descriptor . jslogContext ) } ` ,
552- parent || descriptors ) ;
555+ parent || descriptors , new DOMRect ( 0 , 0 , MENU_ITEM_WIDTH_FOR_LOGGING , MENU_ITEM_HEIGHT_FOR_LOGGING ) ) ;
553556 } else if ( descriptor . type === 'subMenu' ) {
554557 VisualLogging . registerLoggable (
555- descriptor , `${ VisualLogging . item ( ) . context ( descriptor . jslogContext ) } ` , parent || descriptors ) ;
558+ descriptor , `${ VisualLogging . item ( ) . context ( descriptor . jslogContext ) } ` , parent || descriptors ,
559+ new DOMRect ( 0 , 0 , MENU_ITEM_WIDTH_FOR_LOGGING , MENU_ITEM_HEIGHT_FOR_LOGGING ) ) ;
556560 }
557561 if ( descriptor . subItems ) {
558562 this . registerLoggablesWithin ( descriptor . subItems , descriptor ) ;
@@ -592,7 +596,9 @@ export class ContextMenu extends SubMenu {
592596 Host . InspectorFrontendHost . InspectorFrontendHostInstance . events . addEventListener (
593597 Host . InspectorFrontendHostAPI . Events . ContextMenuItemSelected , this . onItemSelected , this ) ;
594598 }
595- VisualLogging . registerLoggable ( menuObject , `${ VisualLogging . menu ( ) } ` , this . loggableParent ) ;
599+ VisualLogging . registerLoggable (
600+ menuObject , `${ VisualLogging . menu ( ) } ` , this . loggableParent ,
601+ new DOMRect ( 0 , 0 , MENU_ITEM_WIDTH_FOR_LOGGING , MENU_ITEM_HEIGHT_FOR_LOGGING * menuObject . length ) ) ;
596602 this . registerLoggablesWithin ( menuObject ) ;
597603 this . openHostedMenu = menuObject ;
598604 // showContextMenuAtPoint call above synchronously issues a clear event for previous context menu (if any),
0 commit comments