Skip to main content

Interface: IFlyoutInflater

Defined in: packages/blockly/core/interfaces/i_flyout_inflater.ts:4

Methods index

MethodDescription
loadLoads the object represented by the given state onto the workspace.
gapForItemReturns the amount of spacing that should follow the element corresponding to the given JSON representation.
disposeItemDisposes of the given element.
getTypeReturns the type of items that this inflater is responsible for inflating. This should be the same as the name under which this inflater registers itself, as well as the value returned by getType() on the FlyoutItem objects returned by load().

Methods

load()

load(state, flyout): FlyoutItem;

Defined in: packages/blockly/core/interfaces/i_flyout_inflater.ts:28

Loads the object represented by the given state onto the workspace.

Note that this method's interface is identical to that in ISerializer, to allow for code reuse.

You must ensure that any item created by this method has the appropriate ARIA markup:

  • The role of the element's focusable element should be set to listitem.
  • The focusable element must have an id attribute.
  • Any DOM parents of the focusable element should set their role to presentation to avoid interfering with flyout list navigation.
  • If the element is not focusable, it must be hidden from the ARIA tree. Only do this if the content should be inaccessible to screenreaders.

Parameters

ParameterTypeDescription
stateobjectA JSON representation of an element to inflate on the flyout.
flyoutIFlyoutThe flyout on whose workspace the inflated element should be created. If the inflated element is an IRenderedElement it itself or the inflater should append it to the workspace; the flyout will not do so itself. The flyout is responsible for positioning the element, however.

Returns

FlyoutItem

The newly inflated flyout element.


gapForItem()

gapForItem(state, defaultGap): number;

Defined in: packages/blockly/core/interfaces/i_flyout_inflater.ts:38

Returns the amount of spacing that should follow the element corresponding to the given JSON representation.

Parameters

ParameterTypeDescription
stateobjectA JSON representation of the element preceding the gap.
defaultGapnumberThe default gap for elements in this flyout.

Returns

number

The gap that should follow the given element.


disposeItem()

disposeItem(item): void;

Defined in: packages/blockly/core/interfaces/i_flyout_inflater.ts:49

Disposes of the given element.

If the element in question resides on the flyout workspace, it should remove itself. Implementers are not otherwise required to fully dispose of the element; it may be e.g. cached for performance purposes.

Parameters

ParameterType
itemFlyoutItem

Returns

void


getType()

getType(): string;

Defined in: packages/blockly/core/interfaces/i_flyout_inflater.ts:59

Returns the type of items that this inflater is responsible for inflating. This should be the same as the name under which this inflater registers itself, as well as the value returned by getType() on the FlyoutItem objects returned by load().

Returns

string

The type of items this inflater creates.