Interface: INavigationPolicy<T>
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:12
A set of rules that specify where keyboard navigation should proceed.
Type Parameters
| Type Parameter |
|---|
T |
Methods index
| Method | Description |
|---|---|
| getFirstChild | Returns the first child element of the given element, if any. |
| getParent | Returns the parent element of the given element, if any. |
| getNextSibling | Returns the peer element following the given element, if any. |
| getPreviousSibling | Returns the peer element preceding the given element, if any. |
| getRowId | Returns an ID corresponding to the visual "row" the given element is part of. All elements on the same visual row should share the same ID. For example, icons share their parent block's row ID, as do inline connected blocks or value inputs. Statement inputs, external inputs, or blocks connected to one another's previous or next connections form distinct visual rows and should have distinct row IDs. |
| isNavigable | Returns whether or not the given instance should be reachable via keyboard navigation. |
| isApplicable | Returns whether or not this navigation policy corresponds to the type of the given object. |
Methods
getFirstChild()
getFirstChild(current): IFocusableNode | null;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:19
Returns the first child element of the given element, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | T | The element which the user is navigating into. |
Returns
IFocusableNode | null
The current element's first child, or null if it has none.
getParent()
getParent(current): IFocusableNode | null;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:27
Returns the parent element of the given element, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | T | The element which the user is navigating out of. |
Returns
IFocusableNode | null
The parent element of the current element, or null if it has none.
getNextSibling()
getNextSibling(current): IFocusableNode | null;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:36
Returns the peer element following the given element, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | T | The element which the user is navigating past. |
Returns
IFocusableNode | null
The next peer element of the current element, or null if there is none.
getPreviousSibling()
getPreviousSibling(current): IFocusableNode | null;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:45
Returns the peer element preceding the given element, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | T | The element which the user is navigating past. |
Returns
IFocusableNode | null
The previous peer element of the current element, or null if there is none.
getRowId()
getRowId(current): string;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:58
Returns an ID corresponding to the visual "row" the given element is part of. All elements on the same visual row should share the same ID. For example, icons share their parent block's row ID, as do inline connected blocks or value inputs. Statement inputs, external inputs, or blocks connected to one another's previous or next connections form distinct visual rows and should have distinct row IDs.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | T | The element to return the row ID of. |
Returns
string
The row ID of the given element.
isNavigable()
isNavigable(current): boolean;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:72
Returns whether or not the given instance should be reachable via keyboard navigation.
Implementors should generally return true, unless there are circumstances under which this item should be skipped while using keyboard navigation. Common examples might include being disabled, invalid, readonly, or purely a visual decoration. For example, while Fields are navigable, non-editable fields return false, since they cannot be interacted with when focused.
Parameters
| Parameter | Type |
|---|---|
current | T |
Returns
boolean
True if this element should be included in keyboard navigation.
isApplicable()
isApplicable(current): current is T;
Defined in: packages/blockly/core/interfaces/i_navigation_policy.ts:81
Returns whether or not this navigation policy corresponds to the type of the given object.
Parameters
| Parameter | Type | Description |
|---|---|---|
current | any | An instance to check whether this policy applies to. |
Returns
current is T
True if the given object is of a type handled by this policy.