Skip to content

ally.js

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

🔗ally.is.disabled

Determines if an element is :disabled, or was disabled by ally.element.disabled - i.e. the element is not focusable and editable.

🔗Description

Only form controls (<input>, <select>, <textarea>, <button>) and the <fieldset> element know the disabled attribute. While <fieldset disabled> inherits the disabled state onto descendant form controls, that does not affect the value of the descendant's disabled property. Even the detection of inherited disabled state via the :disabled pseudo does not work reliably cross browser. To make matters worse, Internet Explorer 9 - 11 also support the disabled state for <form> elements, with the same inheritance scheme <fieldset> provides.

🔗Usage

var element = document.getElementById('victim');
var isDisabled = ally.is.disabled(element);

🔗Arguments

NameTypeDefaultDescription
elementHTMLElementrequiredThe Element to test.

🔗Returns

Boolean, true if the element is focus relevant.

🔗Throws

TypeError if element argument is not of type HTMLElement.

🔗Changes

🔗Notes

NOTE: The <fieldset> element can be disabled, inheriting the state onto all form elements it contains.
NOTE: WebKit and Blink do not properly support disabling <fieldset tabindex="0" disabled> elements themselves, while descendant form elements are properly disabled, see Blink 453847, Webkit 141086

🔗Related resources

🔗Contributing