Skip to content

ally.js

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

🔗ally.is.visible

Determines if an element is rendered.

🔗Description

An element is considered visible if it satisfies all of the following rules:

An element can be visible, but not visible within the viewport.

🔗Usage

var element = document.getElementById('victim');
var isVisible = ally.is.visible(element);

🔗Arguments

NameTypeDefaultDescription
elementHTMLElementrequiredThe Element to test.

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

NameTypeDefaultDescription
context<selector>requiredThe 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 visible (i.e. not hidden by CSS).

🔗Throws

TypeError if element argument is not of type HTMLElement.

🔗Changes

🔗Notes

NOTE: <area> elements are not rendered by themselves, so they are always considered visible.

🔗Contributing