layout | tags |
---|---|
doc-api.html |
internal, argument-options |
Identifies the element that would get focus passed to when element.focus()
is executed
Some elements forward focus to another element instead of taking focus themselves.
Consult the data tables what browsers consider focusable and what ally.js fails to consider focusable to learn how HTML elements behave.
var element = ally.get.focusRedirectTarget({
context: '#element-to-test',
});
Name | Type | Default | Description |
---|---|---|---|
context | <selector> |
required | The element to identify the target for. |
TypeError
if context
option is not specified.
- Added in
v1.1.0
.
- NOTE: Focus redirection is only tested and evaluated for situations where script shift focus, not pointer (mouse, touch) or keyboard. Identifying pointer focus behavior is an open issue. The
<label>
element is exempted from this limitation.
-
ally.is.focusRelevant
is used to identify elements that can receive focus -
ally.is.focusable
identifies keyboard focusable elements