Skip to content

Latest commit

 

History

History
64 lines (34 loc) · 2.45 KB

disabled.md

File metadata and controls

64 lines (34 loc) · 2.45 KB
layout tags
doc-api.html
argument-list

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

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

Returns

Boolean, true if the element is disabled.

Throws

TypeError if element argument is not of type HTMLElement.

Examples

Changes

  • Since v1.1.0 the <form disabled> is handled properly in Internet Explorer 9 - 11.

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