Skip to content

Refactor ContextMenu TestBench to not expose ContextMenuOverlayElement #7520

@web-padawan

Description

@web-padawan

Describe your motivation

In #4752 the ContextMenuOverlayElement was added and it is used like this:

private ContextMenuOverlayElement getOverlay() {
return $(ContextMenuOverlayElement.class).first();
}

This can be problematic in the future as in V25 we'll switch to native popover and the vaadin-context-menu-overlay element will no longer be teleported to the <body> but instead will always stay inside vaadin-context-menu (either in shadow or light DOM, that's yet to be discussed separately).

Describe the solution you'd like

  • Consider removing the ContextMenuOverlayElement altogether
  • Move methods getMenuItem(String caption) and getMenuItems() to ContextMenuElement
  • Add getOverlay() to the ContextMenuElement using getPropertyElement("_overlayElement")
  • Optionally, also consider updating the openByRightClick() helper to return getOverlay()

Additional context

The API has to be then backported to v23 in #4754

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions