Unplanned
Last Updated: 06 Feb 2026 10:22 by ADMIN
Alexander
Created on: 30 Jan 2026 18:41
Category: Diagram
Type: Feature Request
3
Diagram native context menu support for shapes and connections

Current limitation: The Diagram component does not provide native context menu integration. There are no events like OnShapeContextMenu or OnConnectionContextMenu that fire on right-click. Developers cannot show contextual actions (edit, delete, copy, connect) when user right-clicks on diagram elements.

Requested feature: Add context menu support for Diagram elements:

  1. Context menu events:
    • OnShapeContextMenu — fires on right-click on a shape
    • OnConnectionContextMenu — fires on right-click on a connection
    • OnCanvasContextMenu — fires on right-click on empty canvas area (for "paste", "add shape" actions)
  2. Event arguments:
    • DiagramShapeContextMenuEventArgs:
      • ShapeId — the clicked shape identifier
      • ClientX, ClientY — mouse position for menu placement
      • PageX, PageY — page coordinates
    • DiagramConnectionContextMenuEventArgs:
      • ConnectionId — the clicked connection identifier
      • FromShapeId, ToShapeId — connected shape identifiers
      • ClientX, ClientY, PageX, PageY
    • DiagramCanvasContextMenuEventArgs:
      • ClientX, ClientY, PageX, PageY
      • DiagramX, DiagramY — coordinates in diagram space (for placing new shapes)
  3. Integration with TelerikContextMenu:
    • Ability to bind TelerikContextMenu to diagram and show it on right-click events
    • Automatic prevention of browser default context menu

Use case:
In workflow/process diagram editors, context menu is essential for:

  • Shape actions: Edit, Delete, Duplicate, Copy/Paste, Change type, View details
  • Connection actions: Edit transition, Delete, Change routing
  • Canvas actions: Paste, Add new shape at cursor position, Zoom controls
  • Conditional actions: Show different menu items based on shape type or state

Currently, there is no way to detect right-click on specific diagram elements. The only workaround is complex JavaScript interop to attach event listeners to SVG elements, which is fragile and breaks on re-render.

Example of desired API:

<TelerikDiagram @ref="@DiagramRef"
                OnShapeContextMenu="@OnShapeRightClick"
                OnConnectionContextMenu="@OnConnectionRightClick"
                OnCanvasContextMenu="@OnCanvasRightClick">
    <DiagramShapes>
        @foreach (var shape in Shapes)
        {
            <DiagramShape Id="@shape.Id">
                <DiagramShapeContent Text="@shape.Name" />
            </DiagramShape>
        }
    </DiagramShapes>
</TelerikDiagram>

<TelerikContextMenu @ref="@ShapeContextMenu" 
                    Data="@ShapeMenuItems"
                    OnClick="@OnShapeMenuClick">
    <ItemTemplate Context="item">
        <TelerikFontIcon Icon="@item.Icon" />
        <span>@item.Text</span>
    </ItemTemplate>
</TelerikContextMenu>

@code {
    private TelerikContextMenu<MenuItem>? ShapeContextMenu;
    private string? ClickedShapeId;
    
    private async Task OnShapeRightClick(DiagramShapeContextMenuEventArgs args)
    {
        ClickedShapeId = args.ShapeId;
        await ShapeContextMenu.ShowAsync(args.ClientX, args.ClientY);
    }
    
    private async Task OnShapeMenuClick(MenuItem item)
    {
        switch (item.Action)
        {
            case "edit":
                await OpenShapeEditor(ClickedShapeId);
                break;
            case "delete":
                await DeleteShape(ClickedShapeId);
                break;
            case "duplicate":
                await DuplicateShape(ClickedShapeId);
                break;
        }
    }
}

 

Alternative minimal implementation:
If full context menu integration is complex, at minimum provide the events with coordinates, so developers can manually show TelerikContextMenu or any custom popup.
1 comment
ADMIN
Ivan Danchev
Posted on: 06 Feb 2026 10:22

Hello Alexander,

Thank you for the detailed description of this feature request for enhancing the Diagram. We will monitor the interest and plan it accordingly. 

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.