Skip to content

[context-menu] Add API to define position preference of the ContextMenu when it has a target element. #8499

Open
@TatuLund

Description

@TatuLund

Describe your motivation

This should be analogous to Popover component.

When ContextMenu has a target element it now opens at the mouse cursor position so that one of the corner is at cursor position, e.g. top left or top right depending on available space.

In some applications it would be visually better if the ContextMenu would open in similar fashion than Popover, e.g. slightly below the target component, or above it.

Describe the solution you'd like

I think the most intuitive approach would be to use similar API as Popover

public enum PopoverPosition {
    //@formatter:off
    TOP_START("top-start"),
    TOP("top"),
    TOP_END("top-end"),
    BOTTOM_START("bottom-start"),
    BOTTOM("bottom"),
    BOTTOM_END("bottom-end"),
    START_TOP("start-top"),
    START("start"),
    START_BOTTOM("start-bottom"),
    END_TOP("end-top"),
    END("end"),
    END_BOTTOM("end-bottom");
    //@formatter:off
...

Describe alternatives you've considered

No response

Additional context

Mobile mode does not need to be overriden by this setting.

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