Class: Menu

Constructor

new Menu()

A basic menu class.

Property

openingCoords

package

nullable Blockly.utils.Coordinate

Coordinates of the mousedown event that caused this menu to open. Used to prevent the consequent mouseup event due to a simple click from activating a menu item immediately.

Methods

addChild

addChild(menuItem)

Add a new menu item to the bottom of this menu.

Parameter

menuItem

Blockly.MenuItem

Menu item to append.

Value must not be null.

dispose

dispose()

Dispose of this menu.

focus

package

focus()

Focus the menu element.

getElement

package

getElement() returns Element

Gets the menu's element.

Returns

Element The DOM element.

getSize

package

getSize() returns Blockly.utils.Size

Get the size of a rendered menu.

Returns

non-null Blockly.utils.Size Object with width and height properties.

highlightNext

package

highlightNext()

Highlights the next highlightable item (or the first if nothing is currently highlighted).

highlightPrevious

package

highlightPrevious()

Highlights the previous highlightable item (or the last if nothing is currently highlighted).

render

render(container)

Creates the menu DOM.

Parameter

container

Element

Element upon which to append this menu.

Value must not be null.

setHighlighted

package

setHighlighted(item)

Highlights the given menu item, or clears highlighting if null.

Parameter

item

Blockly.MenuItem

Item to highlight, or null.

setRole

package

setRole(roleName)

Set the menu accessibility role.

Parameter

roleName

Blockly.utils.aria.Role

role name.

Value must not be null.