Skip to content

ally.js

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

# ally.is.onlyTabbable

Determines if an element is considered tabbable and not focusable.

# Description

An element is considered tabbable and not focusable if the element is part of the document's focus navigation sequence, but cannot be focused by script.

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 = document.getElementById('victim');
var isOnlyTabbable = ally.is.onlyTabbable(element);

# Arguments

Name Type Default Description
element HTMLElement required The Element to test.

The underlying rules can also be accessed in the options argument style by calling ally.is.onlyTabbable.rules(options):

Name Type Default Description
context <selector> required The element to examine. The first element of a collection is used.
except <focus identification exception> {} The Element to test.

# Returns

Boolean, true if the element is only tabbable.

# Throws

TypeError if element argument is not of type HTMLElement.

# Changes

# Notes

See ally.is.focusRelevant

There is no way to feature detect if an element is tabbable or not. The Element.tabIndex property gives some indication, but ultimately user agent sniffing (via platform.js) is done internally to fix mismatches.

Even though SVG elements are focusable by script in Internet Explorer, they may lack the .focus() and .blur() methods. In order to safely manage focus for these elements use ally.element.focus and ally.element.blur.

# Contributing