I have created an typescript component for my Context Menu and everything is working great except when the Context menu is activated near the edge of the screen it will go past the edge of the screen and some items will be inaccessible.
This is the HTML structure of my Context Menu
<div id="contextMenu">
<div
class="menu-link"
*ngFor="let menuItem of contextMenuItems; index as i"
(click)="onContextMenuClick($event, menuItem.menuEvent)">
<div *ngIf="menuItem.menuText !== 'divider'">{{ menuItem.menuText }}</div>
<hr *ngIf="menuItem.menuText == 'divider'" />
</div>
</div>
The menu items are dynamically added based on the "context"
right click activates this code
displayContextMenu(event) {
this.myContextMenuService.buildMenu();
this.rightClickMenuPositionX = event.clientX;
this.rightClickMenuPositionY = event.clientY;
}
I've tried several CSS things but nothing has kept the entire menu on the screen no matter where you activate it from.
Taking too long to get an answer from the community. This is how I've decided to solve this problem...hopefully it will help someone else.
The below is triggered by a [ngStyle] call on the "contextMenu" [ngStyle]="getYourClickMenuStyle()"