WebAccessibilityChecker
Package: Libraries.Web · Inherits from: Libraries.Language.Object
WebAccessibilityChecker looks through a finished page for mistakes that break the Web Content Accessibility Guidelines (WCAG 2.1, levels A and AA) and that can be found from the page itself, before it is ever shown. It doesn't change the page; it returns what it found, one problem per item, each naming the guideline and the element. It checks that: - the page has a title and a language (2.4.2, 3.1.1); - no two elements share an identifier (4.1.1); - every picture has a description, even an empty one (1.1.1); - every link and button has a name: words, a description of a picture inside it, or a label (2.4.4, 4.1.2); - every inline frame has a title (4.1.2); - every form field has a label (1.3.1, 4.1.2); - no heading is empty, the page has one level 1 heading, and the page's own headings never skip a level (1.3.1, 2.4.6); - only things a reader can use are in the order Tab follows (2.4.3); - nothing hidden from screen readers can be reached with Tab (4.1.2); - several navigation regions on a page have different names (1.3.1); - every cell naming a column or row has words (1.3.1); - bulleted and numbered lists hold only list items (1.3.1). Parts hidden from everyone (the hidden attribute) or from screen readers (aria-hidden) are skipped for names, since no one meets them there; anything in them that can be reached with Tab is still a problem. Some guidelines can only be checked by a person, or in a browser once scripts run, such as whether a description is a good one, or what a dialog does with focus; this checker doesn't try. A WebSite runs it on every page when asked to, with SetAccessibilityChecks.
Example Code
use Libraries.Web.Page.all
use Libraries.Containers.Array
WebPage page
page:Title("Welcome")
WebAccessibilityChecker checker
Array<text> problems = checker:Check(page)
Actions
Check(Libraries.Web.Page.WebPage target)
Checks one finished page, including anything its site added, such as navigation. Returns the problems found, or none.
Parameters
targetLibraries.Web.Page.WebPage: The page to check.
Returns
Libraries.Containers.Array<text>: The problems, one per item, each starting with the guideline it breaks.