Accessibility
Accessibility means making the chat usable by everyone, including people who use only a keyboard, people who use a screen reader (software that reads the page aloud), and people who use high-contrast displays. The widget follows WCAG 2.2 level AA, a widely used international standard for accessible websites. Most of it works without any setup from you. A few things depend on how your page is built, so they stay your responsibility.
What the widget does for you
Section titled “What the widget does for you”- Keyboard and focus. The open chat window is a dialog named “Chat with {name}”, or by the
titleoption if you set one. When it opens, the cursor moves to the message box, or, from widget version 0.9.1, to the I agree button while the visitor has not yet agreed to yournotice(requireNoticeAgreement). Selecting it moves the cursor to the message box. When it closes, the cursor returns to the chat button. TheTabkey stays inside the window while it is open, andEscapecloses it. From widget version 0.8.0, while the window fills the screen (on phones, or when zoomed in), it is a true modal dialog: the rest of your page cannot be reached at all, by keyboard, screen reader or touch, until it closes. WithshowFeedbackon, choosing “Bad response” moves the cursor into the feedback form, and Cancel moves it back to “Bad response”. - Screen reader announcements. A finished reply is announced once it is complete, as plain text, not word by word. Errors and status messages are announced too. From widget version 0.10.1, sending a message is announced at once with “Message sent. {name} is preparing a response.”, and “Looking that up for you…” follows once if the reply is slow. If sending fails, only the error is announced. New conversation is announced with “New conversation started. Previous messages were cleared.” while the cursor stays in the message box.
- Labeled controls. Every control has a name, and the message box has a label. The conversation says who is speaking and uses real lists.
- Readable colors. The widget picks black or white text for any button or bubble color you choose with
color, and darkensinkColorandaccentColorwhen they are too pale. This protection stops where you replace a color yourself withtheme.colors. See the next two sections. - Reduced motion. When a visitor’s device asks for less motion, the typing effect for ready-made answers is skipped and the full text appears at once.
- High-contrast mode. The widget has its own layout for forced-colors mode, such as Windows High Contrast.
- Language. From widget version 0.8.0, the widget’s own text comes in 11 languages, and the widget marks its language, so screen readers use the right voice and pronunciation, even on a page in another language. Arabic is laid out right to left. A reply or a typed message in another direction, such as English in the Arabic widget, keeps its punctuation in place. See Language options.
- The conversation’s language. From widget version 0.9.0, replies, your visitors’ messages, and your
greeting,titleandnameare marked with the conversation’s language, separately from the widget’s own text. It comes from thecontentLanguageoption, then your page’s<html lang>, then thelanguageoption if your page has nolang. So on a Dutch page, where the widget’s buttons are in English, a Dutch reply is still read with a Dutch voice. See Language options. - A reply in a different language from the conversation’s language is read with the conversation’s voice. For example, on a French page an English reply is read with French pronunciation. The widget cannot tell reliably which language a reply is in.
- Your notice. From widget version 0.9.1, a
noticeis read by screen readers when the chat window opens, until the visitor sends a first message, and stays as the first item of the conversation. WithrequireNoticeAgreement, the notice is read as the description of the I agree button, which is at least 44 pixels tall and always in view, however long the notice is. From widget version 0.10.0, a notice shown as a footer (noticePlacement: 'footer') is read in the same way, takes at most a quarter of the window so the message box always stays in view, and can be reached withTabwhen it is long enough to scroll. See Notice options. - Input methods. Visitors who type Japanese, Chinese or Korean confirm a word with
Enterand cancel it withEscape. From widget version 0.9.0, those keys do not send the message or close the window while a word is being composed.
Colors and contrast
Section titled “Colors and contrast”Contrast is the difference in brightness between text and its background. For the brand colors color, inkColor and accentColor, the widget adjusts colors so text stays readable.
- Supported color formats for
color,inkColorandaccentColorare hex codes, color names such as'yellow',rgb()andhsl(). The formatsoklch(),lab(),lch(),color()andcolor-mix()are not supported yet. The widget writes a warning in the browser console and falls back. Pass the hex code instead. - Colors that depend on context, such as
currentColor,inheritandvar(...), are not accepted either. They, like a malformed color, fall back with a console warning. Ifcolorcannot be used, the widget uses the color set in Aiden if there is one, otherwise the default. - Text on your color. On buttons and bubbles that use your
coloras the background, the widget picks black or white text for the best contrast, however light or dark your color is. - Your color used as text. In a few places your
coloris the text itself, on the chat window’s light background, such as the header controls. If it is dark enough to read comfortably there, including when a visitor hovers over it, the widget uses it as it is. Otherwise the widget uses a darker shade of the same color. A pale brand color therefore looks noticeably darker in those places. - Translucent colors, such as
rgba(0, 0, 0, 0.5)or#rrggbbaa, are turned into the solid color they look like over white. The chat button floats over page content the widget cannot see, so it cannot rely on what is behind it. If you want a lighter button, pass the lighter solid color. - Text and link colors.
inkColorandaccentColor, and the ones set in Aiden, get the same treatment. Each is darkened just enough to stay readable on the assistant’s reply bubble.
Overriding colors with theme.colors
Section titled “Overriding colors with theme.colors”theme.colors lets you replace any single color the widget draws. The widget uses an override exactly as you wrote it. It does not darken it, lighten it or fix its contrast. Your own page’s contrast is then yours to check, so this section says what the widget does and does not check for you.
- Contrast is checked wherever you override a color. When a role you override has too little contrast against the surface it is drawn on, the widget writes a warning in the browser console, with the role, the surface and the ratio. It still uses your color.
- A surface override is checked, but not fixed. Overriding a surface, which is a background, does not recompute the text and lines drawn on it. Instead, the widget warns about each of them that becomes hard to read, and the warning names the role to override too. For example, a dark
panelon its own leaves the chat title, the header controls and the keyboard focus outline nearly invisible, and you get a warning for each. - The text fields follow your theme. From widget version 0.10.6, the message box and the feedback form’s fields are drawn on
panelintext, and their hints inmuted, so a darkpaneldarkens them too. Before 0.10.6 they stayed white, and a lightmutedhint was hard to read on them. - Colors that are not overridden keep their defaults. The defaults were chosen for the default surfaces: a white chat window and a light gray reply bubble.
- Use a solid
primary. A translucentprimaryoverride stays translucent, so the chat button shows your page through it. The icon color on it is chosen as if the button sat over white, so over dark page content the icon can become unreadable. The widget writes a console warning whenprimaryis translucent.
To avoid this, override a surface and everything drawn on it together. This table shows which roles sit on which surface:
| Surface you override | Roles drawn on it |
|---|---|
panel |
primaryText, ink (the chat title), link, muted, text, focusRing, border, inputBorder |
headerHover |
primaryText |
assistantBubble |
ink, link, muted, typingDots, text |
errorBackground |
errorText |
primary |
onPrimary |
For primary, the widget recalculates onPrimary and primaryText from your new primary when you do not override them. Override them only when you want a different color. The other rows have no such help.
The widget checks a role against a surface when you override either of them, and compares the pair with these needs: 4.5:1 for text, which is onPrimary, primaryText, ink, link, muted, text and errorText, and 3:1 for the typing dots, the input border and the focus ring. It does not check border. A translucent override is checked as if it were drawn over white, but it stays translucent on screen, so its real contrast depends on what shows behind it. The check runs when the widget starts, with the colors you pass to init(). When you override any color, it runs again once the colors set in Aiden arrive, using the colors actually shown, and warns only about what is new.
After you override colors, test the result:
- Press
Tabthrough the whole chat window and check that the keyboard focus outline is visible on every control. The outline uses thefocusRingcolor, with a ring in thepanelcolor behind it, so it has to stand out againstpanel. - Read a reply with a link, the message box, the error message and the feedback buttons if you turned on
showFeedback. - Hover the header controls.
- Run an automated contrast check, for example axe, on the page with the chat window open. Also check each color you override against its surface, using the ratios above.
Layout and target sizes
Section titled “Layout and target sizes”- The chat button is never smaller than 24 by 24 pixels.
layout.launcherSizeoutside 24 to 120 is moved to the nearest limit, with a console warning. The 24 pixel floor is the minimum target size in WCAG 2.2 (success criterion 2.5.8). - The chat window stays on the screen.
layout.panelis a preferred size. The window is always capped to the visitor’s screen, and on a screen 400 pixels wide or less, or 420 pixels tall or less, it fills the screen. - On phones, the chat window stays above the on-screen keyboard. From widget version 0.7.3, when the keyboard opens, the window moves and shrinks so the message box and the send button stay visible above it. If a visitor zooms in with two fingers, the window stays where it is, so it does not move around while they read.
- Typing does not zoom the page on iPhone. From widget version 0.7.3, the message box and the feedback fields use text large enough that iPhone does not zoom in when a visitor taps into them.
- Your page stays still behind a full-screen chat window. From widget version 0.7.3, while the chat window fills the screen, your page cannot scroll behind it. Scrolling to the end of the conversation does not scroll your page either.
- Offsets stay inside the screen.
layout.offsetcannot push the chat button off the screen, and it cannot leave less room than a chat window of the minimum size, 280 by 320 pixels, needs.
Text sizes
Section titled “Text sizes”From widget version 0.10.7 you can change the widget’s text sizes with theme.fonts.sizes. Neither WCAG nor the ADA sets a minimum font size. WCAG asks that text can be zoomed to 200%, still works with extra spacing, fits a narrow screen, and has enough contrast. The widget keeps all of these at every size it accepts.
- Keep
messageat 16 pixels or more, or leave it out. 16 pixels is the usual recommendation for body text. When you leavemessageout, replies follow the text size each visitor chose in their browser, and a fixed size replaces that choice. Zoom works either way. The widget does not go below 14 pixels. inputcannot go below 16 pixels. On iPhone, Safari zooms the whole page in when a visitor taps into a smaller text field. A smaller value is raised to 16, with a console warning.title,secondaryandsmallcannot go below 12 pixels. Their defaults, 15, 13 and 12, are the smallest we recommend. If your visitors need larger text, raise them.- Every size is limited to 32 pixels. Up to that, the title, the header buttons and the messages wrap, and every control stays on the screen down to a screen 320 pixels wide and 256 pixels tall.
- A larger size does not change any color. WCAG allows less contrast for large text, but the colors the widget calculates keep every text at 4.5:1 or more against its background, at any size. A color you set in
theme.colorsis used as you wrote it, so its contrast is yours to check, as described in Overriding colors with theme.colors.
Images
Section titled “Images”- Chat button images are decoration. This covers
launcherIconUrl,theme.launcher.iconUrlandtheme.launcher.openIconUrl. The chat button is always named “Open chat” or “Close chat”, so the image has no description of its own. If the image fails to load, the built-in icon stays. - Describe
emptyStateImageUrlwhen it carries meaning. If the image is the only place your brand name appears, setemptyStateImageAltto a short description, such as your brand name rather than “logo”. Leave it out if the image is only decoration. Do not put essential information only in the image. Say it ingreetingas well. - Use still images. A moving image that plays for more than five seconds would need a pause button, which the widget does not have.
- Images are requested without telling the image’s host which page they appear on.
What stays your responsibility
Section titled “What stays your responsibility”-
Page language. Set the
langsetting on your page’s<html>element correctly. The widget shows its text in your page’s language, unless you pass thelanguageoption. A wrong or missinglanggives the widget the wrong language, and screen readers pronounce the rest of your page wrongly too. -
Do not hide the widget. Do not place the widget’s container, or move it with your own script, inside an element marked
aria-hidden="true"orinert. That hides the whole widget from assistive technology, the tools people with disabilities use to read and operate a page. -
Stacking over your own pop-ups. With the default
zIndex, the chat button is drawn above most page layers, including your own pop-up dialogs and cookie banners. If a pop-up has a control near the widget’s corner, the chat button can cover that control while it has keyboard focus. WCAG 2.2 calls this “Focus Not Obscured” (success criterion 2.4.11). Pass a lowerzIndexso your pop-up covers the chat, or keep that corner of the pop-up clear. -
Room for focused elements. By default, the closed chat button covers a 76 by 76 pixel area in its corner: the 56 pixel button plus a 20 pixel gap. If you change
layout.launcherSizeorlayout.offset, the area changes with them, so adjust the numbers below. Add scroll padding so browsers scroll a selected element clear of it, and avoid putting a small clickable control permanently in that corner:html {scroll-padding-bottom: 96px;} -
A viewport tag for phones. Your page needs
<meta name="viewport" content="width=device-width, initial-scale=1">in its<head>. Without it, a phone shows the page at desktop width and shrinks everything to fit, the widget included, and the widget’s phone layout never applies. Do not addmaximum-scale=1oruser-scalable=noto it. Visitors must be able to zoom in, and the widget does not need either setting. -
The page’s
overflowwhile the chat fills the screen. To stop your page scrolling behind a full-screen chat window, the widget setsoverflow: hiddendirectly on your<html>element, and puts back your own value when the window closes. If your own script changesoverflowon<html>while the window is open, the widget’s restore replaces that change. -
Help in the same place. If the widget is your site’s way of getting help, call
init()on every page that offers help, with the sameposition, so help stays in the same place (WCAG 2.2 success criterion 3.2.6, Consistent Help). -
The
Escapekey. While the chat window is open, the widget closes itself when a visitor pressesEscape. If your page has its ownEscapehandling for the whole page, check that the two do not conflict.
Related pages
Section titled “Related pages”- Configuration reference for
zIndex,position,theme,layoutand the image options - Troubleshooting if another overlay covers the chat button
