Members
(constant) returnFocusTargetsByTrapId :Map.<(string|symbol), HTMLElement>
Global map of trap ID to element that should receive focus when the trap closes. Used by setReturnFocusTarget, markForFocusLater, and returnFocus.
- Map.<(string|symbol), HTMLElement>
Methods
addCurrentToMenuItem(item)
Add the current class and attributes to a menu item.
| Name | Type | Description |
|---|---|---|
item | HTMLElement | The menu item to add the current class and attributes to. |
- Since
- 4.0.2
buildCacheKey(prefix, paramKeys, params) → {string}
Build a cache key.
| Name | Type | Description |
|---|---|---|
prefix | string | The prefix for the cache key. |
paramKeys | Array | The keys of the parameters to build the cache key. |
params | object | The parameters to build the cache key. |
- Since
- 4.0.2
- Source
The cache key.
- Type:
- string
getReturnFocusTarget(id) → {HTMLElement|undefined}
Returns the element currently stored as the return-focus target for the given trap ID.
| Name | Type | Description |
|---|---|---|
id | string | | Focus trap ID. |
- Since
- 5.2.1
The element to return focus to, or undefined if none is set.
- Type:
- HTMLElement |
undefined
removeCurrentFromMenuItem(item)
Remove the current class and attributes from a menu item.
| Name | Type | Description |
|---|---|---|
item | HTMLElement | The menu item to remove the current class and attributes from. |
- Since
- 4.0.2
setReturnFocusTarget(element, id) → {void}
Sets the element to return focus to when the focus trap with the given ID closes. Call from outside the trap to override the default; pass null for element to clear.
| Name | Type | Description |
|---|---|---|
element | HTMLElement | | Element to focus when the trap closes, or null to clear. |
id | string | | Focus trap ID (must match the focusTrapId passed to useFocusTrap). |
- Since
- 5.2.1
- Type:
- void
useCache(initialState) → {object}
A hook to manage a cache.
| Name | Type | Description |
|---|---|---|
initialState | object | The initial state of the cache. |
- Since
- 4.0.2
- Source
The cache state and actions.
- Type:
- object
useId(defaultId) → {string}
Generates a unique ID if default ID is not provided.
| Name | Type | Description |
|---|---|---|
defaultId | string | The default ID. |
- Since
- 3.2.2
- Source
The ID.
- Type:
- string
usePhoneInputFormatUtils(args) → {object}
Custom hook to access the phone input format utils.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
args | object | The arguments. Properties
|
- Since
- 1.0.0
The return value of the hook.
- Type:
- object