tesk9/accessible-html/2.0.0

NOTE: this package is not compatible with Elm 0.19.1

Accessibility.Widget

Widget States and Properties

Some of these are also globally available, including: busy, disabled, grabbed, hidden, invalid.

Inputs

required : Bool -> Attribute Never

Supported by comboBox, gridCell, listBox, radioGroup, spinButton, textBox, tree

Indicate whether user input is or is not required on a field for valid form submission.

label : String -> Attribute Never

Supported for all elements.

Button

pressed : Maybe Bool -> Attribute Never

Supported on button.

Use pressed when describing a toggle button--a button that can be "toggled" between an on state and an off state (or an on state, an indeterminate state, and an off state).

Please check out these examples as well.

button
    [ pressed <| Just True ]
    [ text "This button should be styled for site viewers such that it's clear it's pressed!" ]

TextBox

multiLine : Bool -> Attribute Never

Supported for textbox only.

Indicate whether the textbox is for multi-line inputs or single-line inputs.

Careful of default keyboard behavior when coupling this property with text inputs, which by default submit their form group on enter.

Auto-complete behavior:

See the autocomplete spec.

autoCompleteInline : Attribute Never

Available on comboBox or textbox. Use when there's a suggestion for completing the field that shows up in the line that the user is completing.

Be sure to indicate that the auto-completed text is selected.

autoCompleteList : Attribute Never

Available on comboBox or textbox. Use when there's a suggestion for completing the field that shows up as a list of options from which the user can pick.

Be sure to indicate that the auto-completed text is selected.

See the autocomplete spec.

autoCompleteBoth : Attribute Never

Available on comboBox or textbox. Use when there's a suggestion for completing the field when there's both inline autocomplete and list autocomplete occurring at once.

Be sure to indicate that the auto-completed text is selected.

See the autocomplete spec.

Selection

checked : Maybe Bool -> Attribute Never

Available on checkbox, option, radio, switch

Check boxes can be checked (Just True), unchecked (Just False), or indeterminate (Nothing). Other elements won't support tri-state checkedness.

See the checked spec.

selected : Bool -> Attribute Never

Supported by gridCell, option, row, tab.

Indicate whether an element (in a single- or multi-selectable widget) is or is not selected.

indeterminate : Attribute Never

Sets the indeterminate value to be true.

Validity

invalid : Bool -> Attribute Never

Supported for all elements.

For invalid grammar or spelling, please see invalidGrammar and invalidSpelling respectively.

invalidGrammar : Attribute Never

Supported for all elements.

invalidSpelling : Attribute Never

Supported for all elements.

Interactability

expanded : Bool -> Attribute Never

Available on button, comboBox, document, link, section, sectionHead, and window.

Trickily, this attribute can be applied to either an element that is itself expanded/collapsed, OR to an elment it controls that is either expanded/collapsed. In the latter case, throw on a controls attribute as well to clarify the relationship.

hidden : Bool -> Attribute Never
readOnly : Bool -> Attribute Never

Supported on checkBox, comboBox, grid, gridCell, listBox, radioGroup, slider, spinButton, and textBox.

Indicates read-only status of a widget, although normal navigation rules and copying behavior should apply. (Read: readOnly elements are navigable but unchangeable, and disabled elements are neither navigable nor unchangebale).

disabled : Bool -> Attribute Never

Supported for all elements. Elements are not disabled (are enabled) by default.

Pop-Ups

Pop-ups are supported for all elements (but not meant for use on tooltips).

The pop-up itself needs to have a containing element with one of these roles: menu, listbox, tree, grid, or dialog, and the pop-up value must match. That is, use hasMenuPopUp if the pop-up container has a role of menu.

See the spec.

hasMenuPopUp : Attribute Never

Indicate that interaction with this element can trigger a menu pop-up.

Be careful while managing focus and triggering.

hasListBoxPopUp : Attribute Never

Indicate that interaction with this element can trigger a listBox pop-up.

Be careful while managing focus and triggering.

hasTreePopUp : Attribute Never

Indicate that interaction with this element can trigger a tree pop-up.

Be careful while managing focus and triggering.

hasGridPopUp : Attribute Never

Indicate that interaction with this element can trigger a grid pop-up.

Be careful while managing focus and triggering.

hasDialogPopUp : Attribute Never

Indicate that interaction with this element can trigger a dialog pop-up.

Be careful while managing focus and triggering.

Orientation and Range Widgets

orientationHorizontal : Attribute Never

Supported on roles with some sense of inherent orientation: progressBar, scrollbar, select, separator, slider, tabList, toolBar

Careful: default behavior is inconsistent across those roles.

orientationVertical : Attribute Never

Supported on roles with some sense of inherent orientation: progressBar, scrollbar, select, separator, slider, tabList, toolBar

Careful: default behavior is inconsistent across those roles.

valueMin : number -> Attribute Never

Supported by progressBar, scrollbar, separator, slider, and spinButton.

Set the min allowed value for a range widget.

valueMax : number -> Attribute Never

Supported by progressBar, scrollbar, separator, slider, and spinButton.

Set the max allowed value for a range widget.

valueNow : number -> Attribute Never

Supported by progressBar, scrollbar, separator, slider, and spinButton.

Set the current value for a range widget. Don't use this property for indeterminate states.

valueText : String -> Attribute Never

Supported by progressBar, scrollbar, separator, slider, and spinButton.

This property takes precedence over valueNow, and should show a human-readable version of the current value. However, valueNow should always be used.

Table Sort-by-column

sortAscending : Attribute Never

Supported by columnHeader and rowHeader, but only where those roles are used on table or grid headers.

This should only be applied to one header at a time.

Table is sorted by this column's values in ascending order.

sortDescending : Attribute Never

Supported by columnHeader and rowHeader, but only where those roles are used on table or grid headers.

Only one column in a table should be sorting the values in table.

Table is sorted by this column's values in descending order.

sortCustom : Attribute Never

Supported by columnHeader and rowHeader, but only where those roles are used on table or grid headers.

Only one column in a table should be sorting the values in table.

Table is sorted by this column's values, but the algorithm for that sorting is custom (not ascending or descending).

sortNone : Attribute Never

Supported by columnHeader and rowHeader, but only where those roles are used on table or grid headers.

Table is not sorted by this column's values.

Misc

multiSelectable : Bool -> Attribute Never

Supported on grid, listBox, tabList, tree. (However, what would it mean for a tabList, say, to have multiple selectable descendants?)

When true, users are not restricted to selecting only one selectable descendant at a time.

Page Hierarchy

level : Int -> Attribute Never

Supported for grid, heading, listItem, row, and tabList.

This attribute is about hierarchy--how many "levels" deep is an element? Please refer to the documentation to get a better sense of when to use.

h7 attributes =
    div (heading :: level 7 :: attributes)