Skip to main content

blockly > FieldImage > computeAriaLabel

FieldImage.computeAriaLabel() method

Computes a descriptive ARIA label to represent this field with configurable verbosity.

A 'verbose' label includes type information, if available, whereas a non-verbose label only contains the field's value.

Note that this will always return the latest representation of the field's label which may differ from any previously set ARIA label for the field itself. Implementations are largely responsible for ensuring that the field's ARIA label is set correctly at relevant moments in the field's lifecycle (such as when its value changes).

Finally, it is never guaranteed that implementations use the label returned by this method for their actual ARIA label. Some implementations may rely on other contexts to convey information like the field's value. Example: checkboxes represent their checked/non-checked status (i.e. value) through a separate ARIA property.

Returns an empty string on clickable images (buttons), as we do not want to include image buttons on the block-level ARIA label. When the button is focused the label is set in recomputeAriaContext below.

Signature:

computeAriaLabel(includeTypeInfo: boolean): string;

Parameters

Parameter

Type

Description

includeTypeInfo

boolean

Whether to include the field's type information in the returned label, if available.

Returns:

string