Skip to content

Latest commit

 

History

History
68 lines (37 loc) · 2.06 KB

focus-redirect-target.md

File metadata and controls

68 lines (37 loc) · 2.06 KB
layout tags
doc-api.html
internal, argument-options

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

HTMLElement.

Throws

TypeError if context option is not specified.

Examples

Changes

  • Added in v1.1.0.

Notes

  • 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.

Related resources

Contributing