Skip to main content
Login

Sign in to access your account

Accessibility - National Design System

A site-wide panel where visitors turn on accessibility modes, adjust text and pick a color filter, with every choice kept across pages

Overview

The accessibility panel is a Panel that a FAB opens on every page. It has three groups. Accessibility Modes are switches that turn on several settings at once. Readable Experience holds tiles for text size, spacing, alignment, highlights, motion and the reading mask. Visually Pleasing Experience holds the color filters. Each choice writes a token on <html>, and CSS changes the page from that token.

Pick another component when:

  • the visitor only switches between light and dark: Themes
  • the setting belongs to one form or page: Switch

Markup

<!-- On every NDS page, after the footer --> <button class="nds-btn nds-primary nds-circle nds-icon-only nds-fab nds-accessibility-toggle" type="button" aria-label="Accessibility settings" data-i18n-aria-label="accessibility.panel_label" aria-expanded="false" data-fab-side="auto" data-panel-side="end" data-panel-toggle="nds-accessibility-panel" data-accessibility-toggle hidden> <i class="nds-icon nds-hgi-accessibility" aria-hidden="true"></i> </button>

The FAB ships hidden, and the FAB script shows it once it is docked. A new page needs its own copy, after the footer.

Behavior

Triggers

Any button with data-accessibility-toggle and data-panel-toggle opens the panel, as the FAB does. The first attribute builds the panel on the first press, with a spinner on the button for about one second. The second opens and closes the panel after that. To open it from your own code, call NDS.Accessibility.open(), as in the API.

While settings are on, each trigger shows how many on a badge over its icon, as the Filter button does. The number is the sum of the three group counts, and it is also added to the button’s name for screen readers, such as “Accessibility settings (3)”. A trigger with no icon shows no badge.

<button type="button" class="nds-btn nds-secondary-outline" data-accessibility-toggle data-panel-toggle="nds-accessibility-panel"> <i class="nds-icon nds-hgi-accessibility" aria-hidden="true"></i> <span class="nds-label">Accessibility settings</span> </button>

Panel Position

The panel slides in from the end edge, and the FAB docks there too. To move both, set data-panel-side on the FAB: with data-fab-side="auto", the FAB docks on that side too. The first button pressed builds the panel on its own data-panel-side, so give every trigger the same value. A custom panel uses the data-panel-side on its <aside>.

Loading

The script loads at page load only for a visitor with saved settings, so their modes apply without a press. Its CSS loads with it, so the page can show without the saved modes for a moment. To stop that flash, add <link rel="stylesheet" href="assets/css/nds-accessibility.min.css"> in <head>, after the main stylesheet. A preload does not stop it. The link blocks the first paint for every visitor.

Custom Panel

To change the panel, put your own copy in a <template class="nds-panel-template"> on every page that has the FAB. It replaces the panel the script builds. The copy below is that panel, with its English text. NDS still writes the page language’s word into every element that keeps a data-i18n or data-i18n-{attribute} marker. Remove the marker to keep your own text.

<template class="nds-panel-template"> <dialog id="nds-accessibility-panel" class="nds-panel nds-accessibility-panel" data-panel-side="end" aria-label="Accessibility settings" data-i18n-aria-label="accessibility.panel_label" data-accessibility-panel> <div class="nds-panel-header"> <span class="nds-featured-icon nds-circle"> <i class="nds-icon nds-hgi-accessibility" aria-hidden="true"></i> </span> <div class="nds-panel-text"> <h2 class="nds-panel-title" data-i18n="accessibility.panel_title">Accessibility Tools</h2> </div> <button class="nds-btn nds-subtle nds-icon-only" data-panel-close type="button" aria-label="Close accessibility panel" data-i18n-aria-label="accessibility.close_panel"> <i class="nds-icon nds-hgi-cancel-01" aria-hidden="true"></i> </button> </div> <div class="nds-panel-body"> <div class="nds-scroll-more nds-divided"> <div class="nds-scroll-more-content"> <div class="nds-sr-only" data-a11y-status role="status" aria-live="polite" aria-atomic="true"></div> <!-- Display — quick toggle --> <div class="nds-accessibility-quick"> <button class="nds-btn nds-subtle nds-icon-only nds-theme-toggle-wrap" data-theme-toggle type="button" aria-label="Toggle theme" data-i18n-aria-label="accessibility.toggle_theme"> <i class="nds-icon nds-hgi-moon-02" aria-hidden="true"></i> </button> </div> <!-- Accessibility settings — one accordion, three items: Modes (switches), Readable Experience (tile grid), Visually Pleasing (tile grid). First item open by default; the other two collapsed to keep the panel compact on first open. --> <div class="nds-accordion nds-lg nds-accessibility-modes" id="a11y-accordion"> <!-- Item 1: Accessibility Modes (bundle switches) --> <div class="nds-accordion-item"> <h3 class="nds-accordion-header"> <button class="nds-btn nds-subtle nds-menu-btn nds-accordion-btn" type="button" aria-expanded="true" data-state="open" aria-controls="a11y-modes-collapse"> <span class="nds-accordion-title"><span data-i18n="accessibility.section_modes">Accessibility Modes</span> <span class="nds-a11y-count nds-tag nds-green nds-rounded nds-sm" data-a11y-count="modes" aria-hidden="true"></span><span class="nds-sr-only" data-a11y-count-sr="modes"></span></span> </button> </h3> <div class="nds-accordion-collapse" id="a11y-modes-collapse" data-state="open"> <div class="nds-accordion-content"> <div class="nds-accordion-body"> <fieldset class="nds-form-group nds-switch-group"> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-epilepsy-safe"> <span class="nds-label" data-i18n="accessibility.mode_epilepsy_safe">Epilepsy Safe Mode</span> <span class="nds-info" data-i18n="accessibility.mode_epilepsy_safe_desc">Stops motion and dampens color intensity</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-epilepsy-safe" class="nds-switch-input" data-a11y-mode="epilepsy-safe"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-visually-impaired"> <span class="nds-label" data-i18n="accessibility.mode_visually_impaired">Visually Impaired Mode</span> <span class="nds-info" data-i18n="accessibility.mode_visually_impaired_desc">Enlarges text and boosts contrast for clearer reading</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-visually-impaired" class="nds-switch-input" data-a11y-mode="visually-impaired"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-cognitive-disability"> <span class="nds-label" data-i18n="accessibility.mode_cognitive_disability">Cognitive Disability Mode</span> <span class="nds-info" data-i18n="accessibility.mode_cognitive_disability_desc">Highlights titles and stops motion to reduce distraction</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-cognitive-disability" class="nds-switch-input" data-a11y-mode="cognitive-disability"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-motor-impaired"> <span class="nds-label" data-i18n="accessibility.mode_motor_impaired">Motor Impaired Mode</span> <span class="nds-info" data-i18n="accessibility.mode_motor_impaired_desc">Enlarges click targets</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-motor-impaired" class="nds-switch-input" data-a11y-mode="motor-impaired"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-colorblind"> <span class="nds-label" data-i18n="accessibility.mode_colorblind">Colorblind Mode</span> <span class="nds-info" data-i18n="accessibility.mode_colorblind_desc">Adjusts colors to distinguish red and green clearly</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-colorblind" class="nds-switch-input" data-a11y-mode="colorblind"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-dyslexia-friendly"> <span class="nds-label" data-i18n="accessibility.mode_dyslexia_friendly">Dyslexia Friendly Mode</span> <span class="nds-info" data-i18n="accessibility.mode_dyslexia_friendly_desc">Uses a clearer font and widens line and word spacing</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-dyslexia-friendly" class="nds-switch-input" data-a11y-mode="dyslexia-friendly"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> <div class="nds-form-container nds-switch"> <div class="nds-form-header"> <label for="a11y-mode-adhd-friendly"> <span class="nds-label" data-i18n="accessibility.mode_adhd_friendly">ADHD Friendly Mode</span> <span class="nds-info" data-i18n="accessibility.mode_adhd_friendly_desc">Stops motion, highlights titles, and enables the reading mask</span> </label> </div> <div class="nds-form-control"> <div class="nds-switch-toggle"> <input type="checkbox" id="a11y-mode-adhd-friendly" class="nds-switch-input" data-a11y-mode="adhd-friendly"> <div class="nds-switch-track"><div class="nds-switch-thumb"></div></div> </div> </div> </div> </fieldset> </div> </div> </div> </div> <!-- Item 2: Readable Experience (tile grid) --> <div class="nds-accordion-item"> <h3 class="nds-accordion-header"> <button class="nds-btn nds-subtle nds-menu-btn nds-accordion-btn" type="button" aria-expanded="false" aria-controls="a11y-readable-collapse"> <span class="nds-accordion-title"><span data-i18n="accessibility.section_readable">Readable Experience</span> <span class="nds-a11y-count nds-tag nds-green nds-rounded nds-sm" data-a11y-count="readable" aria-hidden="true"></span><span class="nds-sr-only" data-a11y-count-sr="readable"></span></span> </button> </h3> <div class="nds-accordion-collapse" id="a11y-readable-collapse"> <div class="nds-accordion-content"> <div class="nds-accordion-body"> <div class="nds-grid" role="group" aria-label="Readable experience controls" data-i18n-aria-label="accessibility.aria_readable"> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-setting="font-step" data-a11y-cycle="0,1,2,3" aria-pressed="false"> <i class="hgi hgi-stroke hgi-text-smallcaps" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.font_sizing">Font Sizing</span> <span class="nds-accessibility-tile-bars" data-a11y-bars aria-hidden="true"></span> <span class="nds-sr-only" data-a11y-value>Default</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-mode="dyslexia" aria-pressed="false"> <i class="hgi hgi-stroke hgi-glasses" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.dyslexia">Dyslexia Friendly</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-mode="highlight-titles" aria-pressed="false"> <i class="nds-icon nds-hgi-highlighter" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.highlight_titles">Highlight Titles</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-mode="highlight-links" aria-pressed="false"> <i class="hgi hgi-stroke hgi-link-04" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.highlight_links">Highlight Links</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-mode="reading-mask" aria-pressed="false"> <i class="nds-icon nds-hgi-search-01" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.reading_mask">Reading Mask</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-mode="reduce-motion" aria-pressed="false"> <i class="hgi hgi-stroke hgi-pause" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.pause_motion">Pause Motion</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-setting="text-align" data-a11y-cycle="default,end,start,justify" aria-pressed="false"> <i class="hgi hgi-stroke hgi-text-align-left" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.text_align">Text Alignment</span> <span class="nds-accessibility-tile-bars" data-a11y-bars aria-hidden="true"></span> <span class="nds-sr-only" data-a11y-value>Default</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-setting="line-height" data-a11y-cycle="normal,1.6,1.8,2.0" aria-pressed="false"> <i class="hgi hgi-stroke hgi-paragraph-spacing" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.line_height">Line Height</span> <span class="nds-accessibility-tile-bars" data-a11y-bars aria-hidden="true"></span> <span class="nds-sr-only" data-a11y-value>Default</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-setting="letter-spacing" data-a11y-cycle="0,0.04em,0.08em,0.12em" data-a11y-exclude-token="letter-spacing" aria-pressed="false"> <i class="hgi hgi-stroke hgi-letter-spacing" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.letter_spacing">Letter Spacing</span> <span class="nds-accessibility-tile-bars" data-a11y-bars aria-hidden="true"></span> <span class="nds-sr-only" data-a11y-value>Default</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-setting="word-spacing" data-a11y-cycle="0,0.16em,0.32em,0.48em" aria-pressed="false"> <i class="hgi hgi-stroke hgi-text-kerning" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.word_spacing">Word Spacing</span> <span class="nds-accessibility-tile-bars" data-a11y-bars aria-hidden="true"></span> <span class="nds-sr-only" data-a11y-value>Default</span> </button> </div> </div> </div> </div> </div> <!-- Item 3: Visually Pleasing Experience (single-pick filters + colorblind primitive) --> <div class="nds-accordion-item"> <h3 class="nds-accordion-header"> <button class="nds-btn nds-subtle nds-menu-btn nds-accordion-btn" type="button" aria-expanded="false" aria-controls="a11y-visual-collapse"> <span class="nds-accordion-title"><span data-i18n="accessibility.section_visual">Visually Pleasing Experience</span> <span class="nds-a11y-count nds-tag nds-green nds-rounded nds-sm" data-a11y-count="visual" aria-hidden="true"></span><span class="nds-sr-only" data-a11y-count-sr="visual"></span></span> </button> </h3> <div class="nds-accordion-collapse" id="a11y-visual-collapse"> <div class="nds-accordion-content"> <div class="nds-accordion-body"> <div class="nds-grid" role="group" aria-label="Visual adjustments" data-i18n-aria-label="accessibility.aria_visual"> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="boost-contrast" aria-pressed="false"> <i class="hgi hgi-stroke hgi-flash" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_boost_contrast">Boost Contrast</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="monochrome" aria-pressed="false"> <i class="hgi hgi-stroke hgi-color-picker" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_monochrome">Monochrome</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="high-contrast" aria-pressed="false"> <i class="hgi hgi-stroke hgi-blur" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_high_contrast">High Contrast</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="high-saturation" aria-pressed="false"> <i class="hgi hgi-stroke hgi-sparkles" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_high_saturation">High Saturation</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="low-saturation" aria-pressed="false"> <i class="hgi hgi-stroke hgi-droplet" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_low_saturation">Low Saturation</span> </button> <button type="button" class="nds-btn nds-secondary-outline nds-indicator" data-a11y-visual="cvd-deutan" aria-pressed="false"> <i class="hgi hgi-stroke hgi-colors" aria-hidden="true"></i> <span class="nds-label" data-i18n="accessibility.visual_cvd_deutan">Deuteranopia</span> </button> </div> </div> </div> </div> </div> </div> </div> <button class="nds-btn nds-subtle nds-show-more" type="button" aria-label="Scroll panel" data-i18n-aria-label="accessibility.scroll_panel"> <i class="nds-icon nds-hgi-arrow-down-01" aria-hidden="true"></i> </button> </div> </div> <div class="nds-panel-footer"> <button class="nds-btn nds-secondary-outline" type="button" data-accessibility-action="reset"> <span class="nds-label" data-i18n="accessibility.reset">Reset Settings</span> <div class="nds-progress-circle"> <svg width="100%" height="100%" viewBox="0 0 24 24"> <circle class="nds-progress-bg" cx="12" cy="12" r="10" fill="none" stroke-width="2"></circle> <circle class="nds-progress-track" cx="12" cy="12" r="10" fill="none" stroke-width="2" stroke-dasharray="62.83" stroke-dashoffset="62.83" stroke-linecap="round"></circle> </svg> </div> </button> </div> </dialog> </template>

Removal

To remove the panel from a page, delete its FAB and every other data-accessibility-toggle button. With none on the page, nothing of the panel loads, even for a visitor with saved settings.

Text

The panel reads its English from the script and its Arabic from the accessibility section of assets/i18n/ar.json. To change some of it, set window.NDS_I18N.accessibility before the NDS scripts: each key you set replaces that text, and the rest keep the file’s text. See Internationalization.

Built-in Features

  • Auto-initialization

    The page carries only the FAB. The script and the panel load on the first press, so a visitor who never opens the panel downloads none of it.

  • Seven Accessibility Modes

    One switch each for epilepsy, visual impairment, cognitive load, motor impairment, color blindness, dyslexia and ADHD. A mode changes only the settings the visitor left at default. Turning it off restores each one the visitor did not change since.

  • Ten Readable Tiles

    Font size, dyslexia font, title and link highlights, reading mask, motion pause, text alignment, line height, letter spacing and word spacing. A tile with levels shows a bar for each one.

  • One Color Filter at a Time

    Boost contrast, monochrome, high contrast, high saturation, low saturation and a deuteranopia simulation. Turning one on turns the others off. Except High Contrast, the filters do not apply while a Windows contrast theme is on.

  • Reading Mask

    Dims the screen except for one band. The band stays put on scroll and moves only by drag or by key. Its toolbar changes the band's height or closes the mask, and moves above the band when there is no room below. The band keeps its place after a reload.

  • Cross-Page Persistence

    Every choice is saved in localStorage['nds-a11y'] and applies on every page. When every setting is back at default, the key is removed.

  • OS Preference Sync

    The device's reduced motion and more contrast settings turn on Pause Motion and High Contrast. A change to them during the visit applies at once.

  • Localized Live Announcements

    A screen reader hears every change and reset in the page's language. The text comes from the accessibility section of the pack.

  • Two-Press Reset

    The first press on Reset Settings starts a 5-second countdown on the button. A second press within it resets everything.

Best Practices

  • Keep the FAB on every page. A visitor who set the panel up on one page expects to find it on the next.
  • Add a second trigger in the footer or the main menu. A keyboard user then reaches the panel in the normal tab order.
  • Put a trigger where the visitor reads. Focus goes back to it when the panel closes, and the browser scrolls to it.
  • Move the FAB and the panel to the start edge when a chat widget or a sticky button holds the end corner.
  • Do not build your own switches for these modes. They would conflict with the saved settings. Link to the panel, or call NDS.Accessibility.toggleMode().
  • Write your own --typo-* tokens as calc(value * var(--user-font-scale, 1)), so Font Sizing scales them too.
  • Check your own colors with High Contrast on, in light and dark mode. High Contrast swaps the semantic color tokens, so a color that does not use them stays the same.
  • Do not offer the Deuteranopia filter as an aid. It shows what a visitor with deuteranopia sees, for design checks. Visitors get real correction from their device’s color filters.

API

Classes

Class Element Effect
nds-accessibility-toggle the FAB Names the FAB for your own CSS. NDS gives it no styles, and nds-fab docks it
nds-accessibility-panel the panel <dialog> Fixes the panel’s text sizes, so Font Sizing and the dyslexia font do not change the panel. Pair it with nds-panel
nds-panel-template a <template> Holds your own panel. See Panels
nds-accessibility-modes the accordion in the panel Sets the padding of the mode switches
nds-accessibility-quick a row in the panel body The row of quick buttons, such as the theme button
nds-accessibility-tile-bars a span in a tile with levels Holds the level bars. The script adds one nds-accessibility-tile-bar for each level
nds-a11y-count a tag in an accordion title Shows the number of controls that are on in that group. It hides while empty

Data Attributes

Attribute Element Effect
data-accessibility-toggle the FAB, or any button outside the panel The first press loads the script and builds the panel. Pair it with data-panel-toggle
data-panel-toggle the same button ="nds-accessibility-panel". Opens and closes the built panel and sets aria-expanded. The script adds aria-controls once it builds the panel, so the markup leaves it out. See Panels
data-panel-side every data-accessibility-toggle button The edge the panel slides from: end (default), start, left or right. start and end flip with the text direction. The script copies it from the first button pressed onto the panel it builds
data-fab-side the FAB The FAB’s edge: start, end, left, right or bottom. auto docks on the FAB’s data-panel-side. See FAB
data-state~="loading" the pressed button The script sets it while the panel loads, and removes it about one second later
data-accessibility-panel the panel <dialog> Marks the panel. A panel already in the page is used instead of a template
data-armed the panel <dialog> The script sets it when it builds the panel
data-a11y-status a screen-reader role="status" element in the panel The script writes each announcement in it
data-a11y-count the count tag in an accordion title modes, readable or visual. The script writes the group’s count in it. It counts inside #a11y-modes-collapse, #a11y-readable-collapse and #a11y-visual-collapse, so keep those ids
data-a11y-count-sr a screen-reader span next to the tag The same group names. The script writes the count as text for screen readers
data-a11y-mode a mode switch input, or a tile button The mode or token the control turns on and off: a name from Modes or from Tokens on <html>
data-a11y-setting a tile button with levels The setting the tile changes. The panel’s values: font-step 0,1,2,3, text-align default,end,start,justify, line-height normal,1.6,1.8,2.0, letter-spacing 0,0.04em,0.08em,0.12em, word-spacing 0,0.16em,0.32em,0.48em
data-a11y-cycle the same tile button The values a press steps through, separated by commas. The first value is the default
data-a11y-bars a span in that tile The script adds one bar for each value after the first
data-a11y-value a screen-reader span in that tile The script writes the current value in it
data-a11y-visual a filter tile button The filter the tile turns on. Turning it on turns the other filters off
data-a11y-exclude-token a tile button letter-spacing: the script removes the tile on a page whose language is written in a script that joins its letters, such as Arabic, Persian or Urdu, because letter spacing breaks them. The browser names the script from lang on <html>. A saved letter spacing does not apply there either
data-state~="selected" a tile button The script sets it, with aria-pressed="true", while the tile is on, and removes it when the tile turns off
data-accessibility-action the reset button ="reset". Two presses within 5 seconds reset every setting
data-state~="arming" the reset button The script sets it after the first press, and removes it after the second press or after 5 seconds
data-a11y <html> The script writes the tokens that are on, separated by spaces. See Tokens on <html>

CSS Custom Properties

Property Default Controls
--user-font-scale 1 The scale of every --typo-* token. Set it on <html>: the tokens resolve there, so on another element it changes nothing. The font-step-* tokens set it
--user-line-height normal The line height of body text. The script writes it on <html>
--user-letter-spacing 0 The letter spacing of body text. The script writes it on <html>
--user-word-spacing 0 The word spacing of body text. The script writes it on <html>

The panel’s width and top come from Panels. The FAB’s distance from the edge comes from FAB.

Modes

Pass the mode name to toggleMode().

Mode Turns on WCAG
epilepsy-safe reduce-motion, low-saturation 2.3.1
visually-impaired high-contrast, font-step-2 1.4.6
cognitive-disability highlight-titles, reduce-motion 2.2, 2.3
motor-impaired motor-impaired 2.5.5
colorblind cvd-deutan 1.4.1
dyslexia-friendly dyslexia, highlight-links, line height 1.6, letter spacing 0.12em, word spacing 0.16em 1.4.8, 1.4.12
adhd-friendly reduce-motion, highlight-titles, reading-mask 2.2, 2.3

Tokens on <html>

CSS reads these tokens with [data-a11y~="…"]. A mode writes the tokens of the settings it turns on, not its own name. Only Motor Impaired writes its own name.

Token Set by Effect
reduce-motion Pause Motion. The Epilepsy Safe, Cognitive Disability and ADHD Friendly modes. The device’s reduced motion setting Stops animations and transitions, and pauses autoplay video and audio once. Progress bars, progress rings and loading spinners keep moving
high-contrast High Contrast. The Visually Impaired mode. The device’s more contrast setting Swaps the semantic color tokens for black on white, or white on black in dark mode
boost-contrast Boost Contrast filter: contrast(1.15) on the page
monochrome Monochrome filter: grayscale(1) on the page
high-saturation High Saturation filter: saturate(2) on the page
low-saturation Low Saturation. The Epilepsy Safe mode filter: saturate(0.5) on the page
cvd-deutan Deuteranopia. The Colorblind mode Shows the page as a visitor with deuteranopia sees it. It uses the color matrix of Chrome DevTools’ vision deficiency emulation
dyslexia Dyslexia Friendly. The Dyslexia Friendly mode Changes the font to OpenDyslexic for Latin text and Maqroo for Arabic text, and sets body text to weight 500
highlight-titles Highlight Titles. The Cognitive Disability and ADHD Friendly modes Outlines every heading in the warning colors
highlight-links Highlight Links. The Dyslexia Friendly mode Gives every link a dashed outline, and underlines text links
reading-mask Reading Mask. The ADHD Friendly mode Shows the reading mask at z-index: 850. A layer below that is dimmed with the page
motor-impaired The Motor Impaired mode Makes every button at least 48 × 48px
font-step-1, font-step-2, font-step-3 Font Sizing. The Visually Impaired mode sets step 2 Sets --user-font-scale to 1.15, 1.30 or 1.50
text-align-start, text-align-end, text-align-justify Text Alignment Aligns paragraphs and list items
has-line-height, has-letter-spacing, has-word-spacing Line Height, Letter Spacing and Word Spacing. The Dyslexia Friendly mode sets 1.6, 0.12em and 0.16em, with no letter spacing on a page whose script joins its letters, such as Arabic Applies the matching --user-* value to paragraphs, lists and quotes

The text and highlight rules reach only the page’s header, main and footer, so the panel and the FAB keep their look.

Reading Mask Keyboard

Key Effect
Arrow Up, Arrow Down Moves the band 20px. Focus must be on the move button in the mask toolbar
Page Up, Page Down Moves the band 100px
Home, End Moves the band to the top or the bottom of the screen
Escape Turns the reading mask off, when the panel is closed

The toolbar’s size buttons change the band’s height in 40px steps, from 40px to 320px.

JavaScript

Method Effect
NDS.Accessibility.open(trigger) Opens the panel. The first call builds it and shows the spinner on trigger
NDS.Accessibility.close() Closes the panel
NDS.Accessibility.toggle(trigger) Opens or closes the panel
NDS.Accessibility.toggleMode(name) Turns a mode or a token on or off
NDS.Accessibility.setVisualFilter(name) Turns on one filter and turns off the others. The same name again turns it off
NDS.Accessibility.cycleSetting(key, values) Sets key to the value after its current one in values
NDS.Accessibility.reset() Resets every setting at once, with no second press
NDS.Accessibility.state A copy of the saved settings. Changing it changes nothing
NDS.Accessibility.isReady true once the panel is built and wired
NDS.Accessibility.isStarted true once init() has run, from a press or from the loader
NDS.Accessibility.init(trigger) Builds and wires the panel. The first press calls it, so you rarely need it

Before the script loads, NDS.Accessibility is a stub. A call to it loads the script, then runs. The component fires no events. Open the panel from a menu link:

document.getElementById('menu-a11y').addEventListener('click', (e) => { e.preventDefault(); e.stopPropagation(); // the panel closes on an outside click NDS.Accessibility.open(e.currentTarget); });

The full API is in the banner of _js/nds-accessibility.js.

Last Modified Date: 31/10/2026 - 10:30 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks