Skip to content

ally.js

JavaScript library to help modern web applications with accessibility concerns by making accessibility simpler

🔗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 considers focusable to learn how HTML elements behave.

🔗Usage

var element = ally.get.focusRedirectTarget({
  context: '#element-to-test',
});

🔗Arguments

NameTypeDefaultDescription
context<selector>requiredThe element to identify the target for.

🔗Returns

HTMLElement.

🔗Throws

TypeError if context option is not specified.

🔗Changes

🔗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