0

I have a nested div structure. The Main div width 100% have one context menu. The child div width 25% have one context menu. When I click child div both context menu getting open. how to restrict the parent one? can anyone please help

 <div class="icon-td" (contextmenu)="sheetMenu($event);">
        <button mat-icon-button  
          (click)="hideChild(lineitem)">
          <mat-icon class="mat-icon-rtl-mirror">
            {{lineitem.display ? 'expand_less' : 'chevron_right'}}
          </mat-icon>
        </button>
        <div >
          <mat-icon class="note-icon">sticky_note_2_outline</mat-icon>
        </div>
        <mat-form-field floatLabel="never" class="line-item-field"  (contextmenu)="lineItemMenu($event);">
          <input [style.marginLeft.px]="lineitem.level * 16" matInput
           [value]="lineitem.lineItem" [id]="'line_'+lineitem.id">
        </mat-form-field>
      </div>

multiple menu got open

Expected is only lineItemMenu should open. but both sheetMenu and lineItemMenu getting open.

1 Answer 1

2

You should add event.stopPropagation(); in lineItemMenu method.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.