Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

Names, Roles and Announcements

How to name controls, hide text visually without hiding it from screen readers, announce changes, and what each component sets for you.

Accessible names

Every control needs a name that a screen reader can speak and that voice control can target. Visible text is the best name, because every reader gets the same one. Where a design has no room for text, the name still has to exist in the markup.

Press the button in the demo to draw the names that are present but not displayed.

Need Use Why
Name an icon-only button aria-label on the button The shortest form. Use a .visually-hidden span when the name contains markup or has to pass through the same translation step as the page text.
An icon beside visible text Nothing The text names the control. <icon-wc> hides itself from screen readers unless you give it a label.
Label an input that has no visible label <label class="visually-hidden"> A placeholder is not a label. It disappears on input and many screen readers do not read it as the name.
Name a group of radios or checkboxes <legend>, hidden with .visually-hidden if the design has no place for it A <fieldset> without a legend has no name.
Give a section a heading that only screen readers need <h2 class="visually-hidden"> Screen reader users move through a page by heading. An aria-label on the section does not appear in that list.
Say that a link opens a new tab or downloads a file A .visually-hidden span inside the link Sighted readers get the icon. Everyone else needs the words before they follow the link.

Hiding text visually

.visually-hidden is in the core stylesheet. It removes an element from the display and keeps it in the accessibility tree.

Three ways to hide content do different things. Pick by who should lose it.

TechniqueSighted readersScreen readers
.visually-hiddenHiddenRead
aria-hidden="true"ShownSkipped
hidden or display: noneHiddenSkipped

Never put aria-hidden="true" on something focusable. The reader can still tab to it and hears nothing.

Announcing changes

When content changes without a page load, a sighted reader sees it and a screen reader user does not, unless the change happens inside a live region. Changing the text of a live region is the whole mechanism.

Two rules keep announcements reliable:

  • The region is in the page before its text changes. A region inserted with its message already in it is often not announced.
  • Polite is the default. An alert cuts off whatever is being read. Use it for a failure the reader has to act on, and for little else.

The shared live region

Components and utilities announce through one function, and your code can use it too. It keeps one region per politeness level in the document, so the region exists before the first message, and it repeats a message that is sent twice.

What components announce

Generated from the data kept beside each component.

ComponentAnnounces
<ai-chat>Each new message, politely, through the role="log" thread; the thread is aria-busy while a reply streams, so the reply is read when it is complete
<ai-summary>Availability and notice messages through role="status", and the summary text politely as it is generated
<analytics-panel>The analytics state through role="status", each time its message changes
<audio-player>A message through role="status" when the audio cannot be loaded
<author-index>The number of matching authors, politely, after each change to the filter field
<calendar-wc>The month and year in the header, politely, when the visible month changes
<card-list>A loading message and any fetch error through role="status", when data is loaded from src
<carousel-wc>The slide position ("Slide 2 of 5"), politely, after a slide change; silent while autoplay is running
<chat-window>New messages and a "<name> is typing" notice, through the role="log" thread the author provides
<color-picker>"Color copied", politely, after the copy button is used
<combo-box>The tag that was added or removed, politely, in multiple mode
<comment-box>The characters remaining or over the limit through role="status", once the text is within 10% of data-max-length
<data-table>The sorted column and direction after a sort, the number of matching rows after filtering, and the number of selected rows after a selection change, politely
<date-picker>The month and year in the locale's own format, politely, when the displayed month or year changes
<diagram-wc>The syntax error message, politely, when the diagram source fails to parse; the message is also shown in a paragraph below the diagram
<drag-surface>Grab, each new position, drop, cancel and moves between surfaces, politely
<emoji-picker>The number of matching emoji, politely, after each search
<flow-diagram>The text of the selected step, politely, when a step is activated
<form-field>The validation message, when it is written into the error <output> after the field becomes invalid
<geo-map>The new centre coordinates and zoom level, politely, after the map is panned or zoomed
<glossary-index>The number of matching terms, politely, after each filter change, and that a permalink was copied
<glossary-wc>The number of terms found, politely, after each search, and a load error as an alert
<heading-links>That the link was copied (or that copying failed), politely, after an anchor is activated
<highlight-wc>That a highlight was added or removed, or a note saved, politely
<image-gallery>The new image's alt text and position (for example "Sunset over the bay, 2 of 8"), politely, when the lightbox image changes; the position counter alone when the image has no alt text
<include-file>An error message, as an alert, when loading fails and no fallback content is shown
<markdown-viewer>The error message, assertively, when loading or rendering fails and there is no fallback <pre>
<notification-wc>In panel mode, the title of a notification that arrives after setup and the unread count, politely; in banner mode, the banner when it appears, through role="status" (role="alert" for the error variant)
<page-tour>The step count and heading, politely, on each step, and a ready message when the action required by a gated step is done
<pager-wc>The page status ("Page 2 of 5"), politely, after each page change in the previous/next style
<poll-wc>The total vote count, and the closed state, politely, when it changes
<progress-tracker>The new current step (for example "Step 2 of 4: Profile"), politely, when the current step changes after setup
<qr-code>A copied message, politely, after copy() succeeds
<reader-view>The page indicator, politely, when the page changes in pages mode
<settings-panel>The result of a reset, cache clear or update check, politely, when it finishes
<share-wc>A copied message, politely, after the link or the selected quote is copied
<site-index>The number of matching terms, politely, as the filter text changes
<site-search>The search status, the result count or a no-results message, politely, after each search
<slide-accept>The activated label, politely, when the slide completes
<social-embed>A loading message when loading starts and an error message when it fails, politely
<social-feed>Nothing; counts carry visually hidden labels
<social-links>Nothing; each link is named by its label text
<star-rating>That the rating was cleared, politely, when the selected star is cleared (rating effect loaded)
<status-wc>Changes to its label text, politely, unless data-live="off"
<time-index>How many entries are shown, politely, after the version filter changes
<toast-msg>Each new toast, prefixed with its variant name, politely unless the author sets aria-live="assertive" on the host
<trust-filter>How many pages match, politely, after each filter change
<version-switcher>A notice that the page shows an archived version, politely, shortly after it renders
<video-player>Playing, paused, ended and buffering states, politely; the playback speed, once, when it is changed with the speed button

Roles and states by component

Each component sets the roles and states its pattern needs. This table lists them, names the pattern, and says what is left to you. It is generated from the data kept beside each component, and a release check compares it with the component's code.

A pattern name that begins with Native means the component adds little or no ARIA, because the element underneath already carries the role. Patterns that link out follow the ARIA Authoring Practices Guide.

ComponentPatternSets for youYou provide
<accordion-wc>Accordionrole="region", aria-expanded, aria-controls, aria-labelledbyA <details> element with a <summary> for each panel; panels are region landmarks only when there are six or fewer
<activity-feed>Feedrole="feed", role="group", aria-label, aria-busy, aria-labelledby, aria-describedby, aria-posinset, aria-setsize, aria-hidden, tabindexAn <article data-activity> for each entry, and an aria-label on the feed when the default "Recent activity" does not describe it
<ai-chat>Live regionrole="log", role="group", aria-live, aria-label, aria-busy, hidden—
<ai-summary>Live regionrole="status", aria-live, aria-busy, hidden—
<analytics-panel>Buttonrole="status", aria-pressed, aria-disabled, aria-describedby, aria-labelledby, aria-hidden, hidden—
<audio-player>Native media controlsrole="group", role="status", aria-label, aria-keyshortcuts, aria-pressed, aria-valuetext, aria-hidden, hiddenAn <audio> element, and an aria-label on the player when the default "Audio player" does not describe it
<audio-visualizer>Decorative canvasaria-hidden—
<author-index>Native details/summaryrole="status", aria-label, aria-hidden, hidden—
<brand-mark>Image with text alternativealtText content naming the brand, or an alt attribute when the logo image stands alone
<bread-crumb>Breadcrumbrole="navigation", aria-label, aria-current, aria-expandedAn <ol> of links, or a <nav aria-label> around the list
<calendar-wc>Gridrole="grid", role="dialog", aria-label, aria-labelledby, aria-selected, aria-multiselectable, aria-current, aria-disabled, aria-live, aria-hidden, tabindex—
<card-list>Live regionrole="status", aria-busy, hiddenA <template> whose markup is accessible on its own (headings, link text, alt text)
<carousel-wc>Carouselrole="region", role="group", aria-roledescription, aria-label, aria-current, aria-live, aria-atomic, tabindex, hiddenAn aria-label on the carousel when the default "Carousel" does not describe it; an aria-label on a slide replaces the generated "n of total"; data-label-track renames the slide track (default "Slides")
<change-set>Buttonrole="group", aria-label, aria-pressed<ins> and <del> elements marking the changes
<chart-wc>Image with data table alternativerole="img", aria-hidden, aria-label, tabindex, hiddenA data table or data source, and a data-title (used as the table caption or the image name)
<chat-input>Native form controlsaria-labelA <textarea> with a label (otherwise it is named "Message") and a named send button
<chat-window>Live region—A <chat-thread role="log" aria-live="polite"> with an aria-label, and a chat-input
<color-picker>Sliderrole="dialog", role="slider", role="group", aria-haspopup, aria-expanded, aria-label, aria-labelledby, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-pressed, aria-hidden, tabindex, hiddenAn <input type="color"> with a <label>
<combo-box>Comboboxrole="combobox", role="listbox", role="option", aria-expanded, aria-autocomplete, aria-controls, aria-activedescendant, aria-selected, aria-multiselectable, aria-invalid, aria-live, aria-atomic, aria-label, hiddenA text input with a <label>, and a list of options
<command-palette>Comboboxrole="combobox", role="listbox", role="group", role="option", aria-label, aria-labelledby, aria-autocomplete, aria-controls, aria-expanded, aria-activedescendant, aria-selected, aria-keyshortcuts, aria-hidden, tabindex, hiddenA label for each command; a label attribute when the default "Command palette" does not describe the dialog
<comment-box>Native form controlsrole="group", role="status", aria-label, aria-busy, aria-disabled, aria-hiddenA label attribute or an associated <label> (otherwise the field is named "Comment")
<comment-thread>Landmark regionrole="region", role="group", aria-label, aria-labelledbyAn <article data-comment> for each comment, and an aria-label on the thread when the default "Comments" does not describe it
<comment-wc>Buttonaria-label, aria-disabled, aria-describedby, aria-hiddenA review-surface (from @profpowell/vb-project-planning) for the comment to attach to; without one the button is marked unavailable
<compare-surface>Sliderrole="slider", role="group", tabindex, aria-label, aria-orientation, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetextTwo child elements to compare, each with its own text alternative, and a label attribute when the default slider name does not fit
<consent-banner>Native dialogaria-labelledby, aria-label, hiddenA <dialog> containing a heading (used as its name) and buttons with value="accept", "reject" or "save"
<content-lens>Native form controlshiddenA data-lens-label on each lens when its data-lens-name does not read well as a radio label
<content-swap>Buttoninert, aria-pressed, role="button", tabindexExplicit [data-swap] triggers should be <button> elements with a text label (any other element is given role="button" and tabindex="0"); without triggers a "Show back" toggle button is generated
<context-menu>Menurole="menu", role="menuitem", role="none", role="separator", role="group", aria-haspopup, aria-expanded, aria-controls, aria-description, aria-disabled, aria-keyshortcuts, aria-labelledby, aria-hidden, tabindexA trigger element and a <menu> of buttons or links with text labels
<data-table>Tablearia-sort, aria-expanded, aria-hidden, aria-current, aria-label, aria-live, aria-atomic, role="status", hiddenA <table> with <th> headers, a caption or other accessible name, labelled row checkboxes and a labelled <button data-action="toggle-expand"> for expandable rows
<date-picker>Comboboxrole="combobox", role="dialog", role="grid", aria-haspopup, aria-expanded, aria-controls, aria-modal, aria-label, aria-labelledby, aria-describedby, aria-selected, aria-current, aria-disabled, aria-required, aria-invalid, aria-hidden, aria-live, aria-atomic, tabindex, hiddenAn <input type="date"> with a <label for> (or an aria-label); the label is passed to the generated combobox
<day-view>Native list with roving tabindexrole="button", role="group", aria-label, tabindexEach <calendar-event> needs a <time datetime> and a text title, from which its label is built
<diagram-wc>Figure with labelled SVGaria-labelledby, aria-describedbyA caption attribute, or accTitle and accDescr lines in the Mermaid source, to name and describe the diagram
<drag-surface>Sortable listrole="list", role="listitem", role="status", tabindex, aria-disabled, aria-pressed, aria-description, aria-label, aria-live, aria-atomic, hiddenAn aria-label on the surface (used in announcements) and readable text or an aria-label in each draggable item. Every item is a tab stop and is described with how to move it
<drop-down>Menu buttonrole="menu", role="menuitem", role="none", role="separator", aria-haspopup, aria-expanded, aria-controls, aria-disabled, aria-label, tabindexA trigger with a text label and a <menu> of buttons or links; in hover (navigation) mode the list keeps link semantics and a toggle button is generated beside a link trigger
<emoji-picker>Non-modal dialog with a listboxrole="dialog", role="toolbar", role="listbox", role="group", role="option", role="status", aria-haspopup, aria-expanded, aria-controls, aria-label, aria-current, aria-selected, aria-hidden, tabindex, hiddenA <button data-trigger> with a text label or aria-label (a default name is added when it has no letters)
<flow-diagram>Figure with a list of buttons (roving tabindex)aria-labelledby, aria-label, aria-describedby, aria-hidden, role="status", aria-live, aria-atomic, tabindexA data-title to name the diagram; otherwise data-label or the default "Flow diagram" is used
<foot-notes>Footnote links (DPUB-ARIA)role="doc-noteref", role="doc-endnotes", role="doc-backlink", role="note", aria-label, aria-labelledby, aria-hidden, inert, hidden, tabindex—
<form-field>Native form controlsaria-describedby, aria-invalidA <label for> for the control, plus <output class="hint"> and <output class="error" aria-live="polite"> elements for the messages
<geo-map>Image, then an application-like region once activatedrole="img", role="region", role="group", role="status", aria-label, aria-roledescription, aria-describedby, aria-hidden, aria-live, tabindex, hiddenA place name (label attribute or caption content) so the map image has a meaningful name
<glossary-index>Landmark navigationaria-current, aria-disabled, aria-label, aria-hidden, role="status", aria-live, aria-atomic, hidden, tabindexA <nav class="glossary-jump"> with an aria-label, and letter sections with ids and headings
<glossary-wc>Disclosurerole="region", role="status", role="alert", role="link", aria-label, aria-controls, aria-expanded, aria-disabled, aria-hidden, aria-live, aria-atomic, hidden, tabindexA <dl> of terms (or a src) with text in every <dt>
<heading-links>Linkaria-label, aria-labelledby, tabindexHeadings with text content inside the element
<highlight-wc>Disclosurearia-expanded, aria-controls, aria-pressed, aria-label, aria-hidden, role="group", hidden—
<icon-wc>Imagerole="img", aria-label, aria-hiddenA label attribute when the icon conveys meaning on its own; without it the icon is hidden from assistive technology
<image-gallery>Native dialogaria-label, aria-expanded, aria-controls, hiddenThumbnail links that each contain an <img> with alt text
<image-map>Group of links and buttons with tooltipsrole="group", role="tooltip", aria-label, aria-describedby, aria-expanded, aria-controls, aria-disabled, aria-hidden, tabindex, hiddenAn <img> with alt text (used as the group name) and a label or text content on each <map-area>
<include-file>Live regionaria-busy, role="alert"—
<markdown-editor>Native form controlsrole="group", aria-label, aria-describedbyA <label for> pointing at the authored <textarea>; without one the textarea is named "Markdown source"
<markdown-viewer>Live regionrole="note", role="alert"A fallback <pre> child if the raw source should stay readable when rendering fails
<nav-bar>Landmark navigationrole="navigation", aria-currentAn aria-label on the host, or on the wrapped <nav>, that names the navigation
<note-wc>Dialog (non-modal)role="dialog", aria-label, aria-hidden, tabindex—
<notification-wc>Non-modal dialog with tabsaria-haspopup, aria-expanded, aria-controls, aria-label, role="dialog", role="status", role="alert", aria-labelledby, role="tablist", role="tab", role="tabpanel", aria-selected, tabindex, role="list", aria-hidden, hidden, popoverIn banner mode, a dismiss button with an accessible name; in panel mode, an accessible name on an authored trigger
<page-info>Native details/summaryaria-label, aria-hidden—
<page-toc>Landmark navigationaria-label, aria-current, tabindexHeadings that have an id and text content inside the scoped container
<page-tools>Toolbarrole="toolbar", aria-label, aria-orientation, tabindex, aria-hidden, popover, hiddenChild controls that each have an accessible name
<page-tour>Dialog (modal)role="dialog", aria-modal, aria-label, tabindex, aria-hidden, aria-live, aria-atomic, aria-disabled, aria-describedby, popoverA heading (h2 to h4) in each tour-step; it receives focus and is announced
<pager-wc>Landmark navigationaria-label, aria-current, aria-live, aria-hidden, role="list", disabled, tabindexAn aria-label on the host when the default name "Pagination" is not specific enough
<poll-wc>Radio grouprole="radiogroup", role="radio", role="group", role="checkbox", aria-checked, aria-disabled, aria-busy, aria-label, aria-labelledby, aria-live, aria-hidden, tabindexA question element or an aria-label on the host to name the option group
<pop-over>Native popoverpopoverA trigger button with popovertarget set to the element's id
<popularity-index>Native links in an ordered listaria-busy—
<print-page>Native buttonaria-label, aria-hidden, role="group"—
<progress-tracker>Native ordered list of stepsaria-current, aria-label, aria-hiddenAn <ol> whose items carry a text label for each step
<qr-code>Imagerole="img", aria-label, aria-description, aria-hidden, hiddenA data-label-prefix when the code needs a name of its own; the encoded value is then its description
<reaction-bar>Toolbarrole="toolbar", aria-label, tabindex, aria-pressed, aria-busy, aria-disabled, aria-haspopup, aria-expanded, role="dialog", role="group", aria-hidden, popovertargetA data-label or aria-label on each reaction button that names the emoji
<reader-view>Toggle buttons with a paged regionrole="region", role="group", aria-label, aria-pressed, aria-live, aria-hidden, inert, tabindex—
<reading-progress>Decorative progress bararia-hidden—
<recently-visited>Buttonaria-pressed, aria-disabled, aria-label—
<score-card>Static contentaria-busy—
<selection-menu>Toolbarrole="toolbar", aria-orientation, aria-label, aria-keyshortcuts, tabindex, popover, hiddenChild buttons or links that each have an accessible name
<settings-panel>Dialog (non-modal)aria-haspopup, aria-expanded, aria-controls, aria-label, role="dialog", tabindex, role="status", role="group", aria-labelledby, aria-hidden, hidden—
<share-wc>Native buttons in a named grouprole="group", aria-label, aria-hidden—
<short-cuts>Native dialogaria-labelledby, aria-label, aria-hidden—
<site-index>Landmark navigationrole="status", aria-label, aria-current, aria-disabled, aria-expanded, tabindex, hiddenA <nav> with an aria-label holding one <section> per letter, each with an <h2> and a list of terms
<site-map>Native details/summary (default mode); Tree view (ia-tree mode)role="tree", role="treeitem", role="group", aria-expanded, aria-current, aria-label, aria-hidden, aria-activedescendant, aria-selected, aria-level, aria-setsize, aria-posinset, aria-valuetext, tabindex roving, hiddenA <nav> with an aria-label wrapping nested lists of links, grouped with <details> in the default mode
<site-search>Combobox in a native dialogrole="combobox", role="listbox", role="option", role="status", aria-haspopup, aria-expanded, aria-controls, aria-autocomplete, aria-activedescendant, aria-selected, aria-label, aria-hidden, tabindexOptionally a trigger button with an accessible name; a labelled search button is generated when none is authored
<slide-accept>Sliderrole="slider", role="status", aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-label, aria-describedby, aria-disabled, tabindexText content that names the action; it becomes the slider's accessible name
<social-embed>Buttonrole="status", aria-disabled, tabindex, titleA fallback link to the post as content, and data-title when the default frame title does not fit
<social-feed>A labelled, focusable scrolling region holding a WAI-ARIA feed (activity-feed) of articlestabindex—
<social-links>A list of native links——
<split-surface>Window splitterrole="separator", aria-controls, aria-orientation, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-label, tabindex, inertTwo child panels; set data-label-resize when the default "Resize panels" name does not fit
<star-rating>Native form controlsrole="img", role="status", aria-label, aria-hiddenA label attribute naming what is rated; the legend defaults to "Rating"
<status-wc>Live regionrole="status", aria-live, aria-hiddenText content or a data-variant, so the status has a text label
<stepper-wc>Spin buttonrole="spinbutton", aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-label, aria-labelledby, aria-disabled, aria-readonly, aria-hidden, tabindexA <label>, aria-labelledby or aria-label for the host; it is forwarded to the spin button
<tab-set>Native details/summary (exclusive group)role="group", aria-controls, aria-labelledby, aria-expandedChild <details> elements, each with a <summary> and a <section> panel
<text-reader>Native form controlsrole="group", aria-label, aria-pressed, aria-hidden, hidden, popover—
<theme-picker>Non-modal dialog with native form controlsrole="dialog", role="group", role="radiogroup", aria-haspopup, aria-expanded, aria-controls, aria-label, aria-labelledby, aria-busy, aria-hiddenOptionally a trigger button with an accessible name; a labelled palette button is generated when none is authored
<time-index>Native form controlsrole="status", aria-live, aria-label, aria-labelledby, hidden—
<time-picker>Combobox with a dialog popup of spin buttonsrole="combobox", role="dialog", role="spinbutton", aria-haspopup, aria-expanded, aria-controls, aria-modal, aria-label, aria-labelledby, aria-describedby, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext, aria-readonly, aria-required, aria-invalid, aria-hidden, tabindexA child <input type="time"> with a <label>; the label is forwarded to the generated text input
<toast-msg>Live regionrole="log", aria-live, aria-relevant, aria-label, aria-hidden—
<tool-tip>Tooltiprole="tooltip", aria-describedby, aria-label, aria-controls, aria-expanded, aria-hidden, popover, interestforA focusable trigger as the first child, and the tip text in a template, the content attribute or the trigger's title
<topic-map>Native details/summary——
<trust-filter>Native form controlsaria-label, aria-live, hidden—
<version-switcher>Native popoverrole="dialog", role="list", role="listitem", role="status", aria-haspopup, aria-expanded, aria-label, aria-labelledby, aria-describedby, aria-current, aria-hidden, tabindex, hiddenAn aria-label on the host when the default trigger name does not fit
<video-player>Media player with custom controls built from native buttons and range inputsrole="group", role="status", tabindex, aria-label, aria-keyshortcuts, aria-pressed, aria-valuetext, aria-live, aria-hidden, inert, hiddenA child <video>, with a captions <track> where speech is present; set aria-label when the default player name does not fit
<watch-wc>Buttonaria-pressed, aria-label, aria-hidden, title—
<week-view>Native table with roving focus across eventsrole="button", role="group", aria-label, aria-current, aria-hidden, tabindex rovingChild <calendar-event> elements with a data-date and a <time>, each with text that names the event
<youtube-player>Buttonaria-label, titleA title attribute naming the video; it names the play button and the player frame

For the states the library styles on your own markup, such as aria-pressed, aria-expanded and aria-busy, see ARIA states.

↑