Skip to main content
Version: v26

ContextMenuPosition

Interface

Properties

attachToXBy

Optional

Tells what side of the context menu widget should be used to "attach" to a provided x coordinate. If the value is undefined, then you may treat it based on whether it is rtl or not (e.g. 'right' for rtl and 'left' otherwise). The value 'auto' behaves as undefined but additionally checks if there is enough space to place the menu and if it's not then the result value is inverted.

Type

"auto" | "left" | "right"


attachToYBy

Optional

Tells what side of the context menu widget should be used to "attach" to a provided y coordinate:

  • 'auto' means similar to 'top' but the menu could be expanded above the coordinate if needed (if there is no enough space to place it below)
  • 'auto-strict' means 'top' if the whole menu fits the space below the coordinate and 'bottom' otherwise (see box)
  • 'top' means that the menu should be placed to the bottom of y coordinate (the menu should be attached by its bottom to y coordinate)
  • 'bottom' means that the menu should be placed above y coordinate (the menu should be attached by its top to y coordinate)

You may treat undefined as 'auto'.

Type

"auto" | "top" | "bottom" | "auto-strict"


box

Optional

The optional structure that helps to more accurate calculate a position of the menu (see attachToYBy).

Type

Object

Type declaration


clientX

X (horizontal) coordinate (in pixels) at which the mouse event occurred, relative to the left edge of the applications viewport.

Type

number


clientY

Y (vertical) coordinate (in pixels) at which the mouse event occurred, relative to the left edge of the applications viewport.

Type

number


marginX

Optional

Additional horizontal margin.

Type

number


marginY

Optional

Additional vertical margin.

Type

number


touches

Optional

Touch positions

Type

readonly { clientX: number ; clientY: number }[]