# ally.get.focusRedirectTarget
Identifies the element that would get focus passed to when element.focus() is executed
# Description
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.
# Usage
var element = ally.get.focusRedirectTarget({
context: '#element-to-test',
});
# Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| context | <selector> |
required | The element to identify the target for. |
# Returns
# Throws
TypeError if context option is not specified.
# Changes
- Added in
v1.1.0.
# Notes
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.
# Related resources
-
ally.is.focusRelevantis used to identify elements that can receive focus -
ally.is.focusableidentifies keyboard focusable elements