JavaScript configuration reference

Every property available in window._cyA11yConfig, its type, accepted values, and default. Scope: this page applies to the direct JavaScript embed — sites that…

Updated

Scope: this page applies to the direct JavaScript embed — sites that set window._cyA11yConfig inline before the widget script tag. It does not apply to the WordPress plugin (configured in wp-admin) or the SaaS/CDN embed (configured in the dashboard — remote configuration there overrides anything set inline).

The widget reads configuration from the global window._cyA11yConfig object once, at the moment the script loads. Set this object before the widget script tag. Any property you omit falls back to its default value.

Provide nested objects complete. Top-level properties are replaced, not deep-merged — only keyboard and modules merge with their defaults. If you override status, position, or margins, include every key of that object. A margins object missing the mobile block stops the button rendering on mobile entirely; a status object with only one device key disables the widget on the other device.

Full configuration object

The object below is the complete shape the script reads, with all defaults.

js

window._cyA11yConfig = {

  // ── Device visibility ─────────────────────────────────
  status: {
    desktop: true,           // render the widget on desktop
    mobile:  true,           // render the widget on mobile
  },

  // ── Appearance ────────────────────────────────────────
  iconId:       'default',   // 'default' | 'accessibility' | 'assist' | 'wheel'
  primaryColor: '#1863DC',   // button colour — 6-digit hex only
  iconSize:     48,          // button diameter in pixels (number)
  label: 'Accessibility widget', // accessible name (screen readers)

  // ── Position ──────────────────────────────────────────
  position: {
    desktop: 'bottom-right', // 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
    mobile:  'bottom-right',
  },
  margins: {                 // distance from screen edges, px
    desktop: { top: 20, bottom: 20, left: 20, right: 20 },
    mobile:  { top: 20, bottom: 20, left: 20, right: 20 },
  },

  // ── Language ──────────────────────────────────────────
  language: {
    default:  'en',  // fallback when the page/browser language is unsupported
    selected: [],    // currently not used — see Language section
  },

  // ── Keyboard shortcut ─────────────────────────────────
  keyboard: {
    enabled:  false,
    shortcut: 'alt+a', // 'alt' | 'ctrl' | 'shift' + a–z, 0–9, f1–f12, space
  },

  // ── Modules ───────────────────────────────────────────
  // Every tool is an { enabled: boolean } object, grouped by panel
  // section. All tools are enabled by default.
  modules: {
    color: {
      darkContrast:    { enabled: true },
      lightContrast:   { enabled: true },
      highContrast:    { enabled: true },
      highSaturation:  { enabled: true },
      lowSaturation:   { enabled: true },
      monochrome:      { enabled: true },
    },
    content: {
      adjustFontSizing: { enabled: true },
      highlightTitle:   { enabled: true },
      highlightLinks:   { enabled: true },
      dyslexicFont:     { enabled: true },
      letterSpacing:    { enabled: true },
      lineHeight:       { enabled: true },
      fontWeight:       { enabled: true },
      textAlign:        { enabled: true },
    },
    navigation: {
      readingGuide:     { enabled: true },
      pauseAnimations:  { enabled: true },
      bigCursor:        { enabled: true },
    },
    statement:  { enabled: false, url: '' },
    profiles:   { enabled: true },  // whole profiles section on/off
    pageRead:   { enabled: true },
    muteSounds: { enabled: true },
  },
};

Property reference

status

Exists and controls whether the widget renders at all, per device type. Turns the widget on or off per device. When the current device’s flag is false, the button is not rendered on that device.

PropertyTypeDefault
status.desktopbooleantrue
status.mobilebooleantrue

Provide both keys when overriding — a missing key is treated as disabled, not as its default.

iconId

The icon displayed inside the widget button. An unrecognised value falls back to the default icon.

ValueDescription
'default'Standard accessibility person icon (default)
'accessibility'Accessibility figure, alternate style
'assist'Assistive-hand icon
'wheel'Wheelchair symbol

primaryColor

The background colour of the floating widget button, as a 6-digit hex value.

PropertyTypeDefault
primaryColorstring (6-digit hex)'#1863DC'

The widget computes focus-ring and shadow colours from this value to keep keyboard focus visible. Three-digit shorthand (#F00) and non-hex formats break that computation — the button still shows your colour, but focus indicators fall back to black. Always use the full six digits.

The button icon is white. Choose a colour with at least a 3:1 contrast ratio against white to meet WCAG 2.1 AA for UI components. You can check ratios at webaim.org/resources/contrastchecker.

iconSize

The diameter of the floating button in pixels.

PropertyTypeDefaultMinimum recommended
iconSizenumber4844

WCAG 2.5.8 (Target Size, AA) requires a minimum touch target of 24×24 px; WCAG 2.5.5 (AAA) recommends 44×44 px. The default 48 px exceeds both. Only reduce the size if space is genuinely constrained.

label

The accessible name of the widget button, announced by screen readers when a visitor focuses the button. Not visible on screen.

PropertyTypeDefault
labelstring'Accessibility widget'

Change this if your site is in a language other than English — for example 'Widget d'accessibilité' for a French-language site.

position

Controls which corner the floating button occupies. Desktop and mobile are set independently.

ValueDescription
'bottom-right'Bottom-right corner (default)
'bottom-left'Bottom-left corner
'top-right'Top-right corner
'top-left'Top-left corner

An unrecognised value falls back to 'bottom-left' (not the bottom-right default). When overriding, set both desktop and mobile — see the note at the top of this page.

margins

The distance in pixels from the button to the screen edges. Only the two edges matching the chosen corner apply — with position: 'bottom-right', the bottom and right values are used.

js

margins: {
  desktop: { top: 20, bottom: 20, left: 20, right: 20 },
  mobile:  { top: 20, bottom: 20, left: 20, right: 20 },
}
PropertyTypeDefault
margins.desktop.top / bottom / left / rightnumber20
margins.mobile.top / bottom / left / rightnumber20

Provide all four edges, for both devices. A partial margins object is not merged with defaults. If the current device’s block is missing, the button fails to render on that device. Increase values if the widget overlaps a sticky footer, cookie banner, or chat launcher; 16–40 px is typical.

language

Controls the widget’s display language.

js

language: {
  default:  'en',
  selected: [],
}
PropertyTypeDefaultDescription
language.defaultstring (language code)'en'Used when the detected page/browser language is not supported. Final fallback is English.
language.selectedstring[][]Currently has no effect — see note below.

The language resolution order is: 1) the page’s detected language (from the document/browser), if supported → 2) language.default, if supported → 3) English. A visitor’s manual choice in the widget’s language switcher is saved in the browser and takes precedence on return visits.

language.selected currently has no effect on the switcher. The switcher always appears and lists all 58 supported languages, with a search box.

Supported languages

The widget supports exactly 58 languages:

CodeLanguageCodeLanguage
amAmharicmsMalay
arArabicmyBurmese
bgBulgariannbNorwegian Bokmål
bnBengalinlDutch
caCatalannoNorwegian
csCzechpaPunjabi
daDanishplPolish
deGermanptPortuguese
elGreekroRomanian
enEnglishruRussian
esSpanishsiSinhala
faPersianskSlovak
fiFinnishslSlovenian
filFilipinosrSerbian
frFrenchsr-SPSerbian Cyrillic
glGaliciansvSwedish
heHebrewswSwahili
hiHinditaTamil
hrCroatianteTelugu
huHungarianthThai
idIndonesiantrTurkish
itItalianukUkrainian
jaJapaneseurUrdu
kaGeorgianviVietnamese
knKannadazh-HansChinese, Simplified
koKoreanzh-HantChinese, Traditional
kuKurdish
lbLuxembourgish
ltLithuanian
lvLatvian
mlMalayalam
mnMongolian

keyboard

Registers a keyboard shortcut that opens the widget without clicking the button.

js

keyboard: {
  enabled:  true,
  shortcut: 'alt+a',
}
PropertyTypeDefaultDescription
keyboard.enabledbooleanfalseWhether the shortcut is active
keyboard.shortcutstring'alt+a'Modifier(s) + key, joined with +

Accepted modifiers are alt, ctrl, and shift, in any combination ('ctrl+shift+k'). The final part is the key: a letter a–z, a digit 0–9, a function key f1–f12, or space. The Cmd/Meta key is not supported. On macOS, alt is the Option key.

Matching is exact — 'alt+a' does not fire on Ctrl+Alt+A — and layout-independent, so the shortcut works the same on non-QWERTY keyboards. The shortcut is ignored while the visitor is typing in a form field or editable area.

Choose a combination that does not conflict with browser or operating-system shortcuts on your target platforms. A shortcut makes the widget discoverable for keyboard users without tabbing to the button — especially useful on long pages.

modules.statement

Controls the accessibility-statement link shown in the widget footer.

js

modules: {
  statement: {
    enabled: true,
    url: 'https://example.com/accessibility-statement/',
  },
}
PropertyTypeDefaultDescription
modules.statement.enabledbooleanfalseShow the statement link in the widget
modules.statement.urlstring''Full URL of your accessibility statement

An accessibility statement is required for public-sector websites in the UK and EU and is considered best practice for any organisation publicly demonstrating accessibility compliance.

With enabled: true and an empty url, the link still appears and points to #. Always provide a URL when enabling this module.

modules — tool visibility

Controls which tools appear in the widget panel. Set a tool’s enabled to false to hide it from all visitors. All tools are enabled by default. When every tool in a group is disabled, that whole panel section is removed.

js

modules: {
  content:    { adjustFontSizing: { enabled: false } }, // hide one tool
  navigation: { bigCursor:        { enabled: false } },
}

Important: hiding a tool prevents all visitors from using it, including those who rely on it. Only disable a tool if it causes a genuine technical conflict with your site. Hiding tools because they alter your visual design is not recommended.

Colour and contrast — modules.color
KeyDefaultWhat it does
darkContrast{ enabled: true }Dark background, light text
lightContrast{ enabled: true }Light background, dark text
highContrast{ enabled: true }Maximum contrast between text and background
highSaturation{ enabled: true }Increases colour intensity
lowSaturation{ enabled: true }Reduces colour intensity
monochrome{ enabled: true }Strips all colour from the page
Content adjustments — modules.content
KeyWhat it does
adjustFontSizingLets visitors increase or decrease text size
dyslexicFontSwitches to a dyslexia-friendly typeface
highlightTitleAdds visual emphasis to headings
textAlignLets visitors realign page text
highlightLinksUnderlines and highlights all links
letterSpacingIncreases spacing between characters
lineHeightIncreases spacing between lines
fontWeightIncreases font weight for improved legibility
Navigation tools — modules.navigation
KeyDefaultWhat it does
readingGuide{ enabled: true }Overlays a horizontal line that follows the cursor
pauseAnimations{ enabled: true }Stops CSS animations and transitions
bigCursor{ enabled: true }Replaces the default cursor with a larger one

modules.profiles

One switch controls the whole profiles section — profiles cannot be toggled individually.

PropertyTypeDefaultDescription
modules.profiles.enabledbooleantrueSet to false to remove the entire profiles section from the panel

The profiles shown when the section is enabled:

ProfileWhat it does
Low VisionIncreases font size, contrast, and cursor size
ADHDReduces distractions and focuses the reading area
Seizure SafeReduces flashing colours and motion
Epilepsy Safe ModeDampens colour and stops flashing animations

Read aloud & sound — modules.pageRead, modules.muteSounds

PropertyTypeDefaultWhat it does
modules.pageRead.enabledbooleantrueRead-page-aloud tool in the navigation section
modules.muteSounds.enabledbooleantrueMute-sounds tool in the navigation section

Minimal embed example

Only position and language configured; everything else uses defaults.

html

<script>
(function(w,d,s,u){
  w._cyA11yConfig = {
    position: { desktop: 'bottom-left', mobile: 'bottom-left' },
    language: { default: 'fr', selected: [] },
  };
  var js = d.createElement(s), fjs = d.getElementsByTagName(s)[0];
  js.src = u;
  js.async = true;
  fjs.parentNode.insertBefore(js, fjs);
})(window, document, 'script',
   'https://cdn-cookieyes.com/widgets/accessibility.js');
</script>

Full configuration example

html

<script>
(function(w,d,s,u){
  w._cyA11yConfig = {
    status: { desktop: true, mobile: true },
    iconId:       'default',
    primaryColor: '#0F4C9A',
    iconSize:     48,
    label:        'Accessibility widget',
    position: {
      desktop: 'bottom-right',
      mobile:  'bottom-left',
    },
    margins: {
      desktop: { top: 24, bottom: 24, left: 24, right: 24 },
      mobile:  { top: 16, bottom: 80, left: 16, right: 16 },
    },
    language: {
      default:  'en',
      selected: [],
    },
    keyboard: {
      enabled:  true,
      shortcut: 'alt+a',
    },
    modules: {
      color: {
        darkContrast:    { enabled: true },
        lightContrast:   { enabled: true },
        highContrast:    { enabled: true },
        highSaturation:  { enabled: true },
        lowSaturation:   { enabled: true },
        monochrome:      { enabled: true },
      },
      content: {
        adjustFontSizing: { enabled: true },
        highlightTitle:   { enabled: true },
        highlightLinks:   { enabled: true },
        dyslexicFont:     { enabled: true },
        letterSpacing:    { enabled: true },
        lineHeight:       { enabled: true },
        fontWeight:       { enabled: true },
        textAlign:        { enabled: true },
      },
      navigation: {
        readingGuide:    { enabled: true },
        pauseAnimations: { enabled: true },
        bigCursor:       { enabled: true },
      },
      statement: {
        enabled: true,
        url: 'https://example.com/accessibility-statement/',
      },
      profiles:   { enabled: true },
      pageRead:   { enabled: true },
      muteSounds: { enabled: true },
    },
  };
  var js = d.createElement(s), fjs = d.getElementsByTagName(s)[0];
  js.src = u;
  js.async = true;
  fjs.parentNode.insertBefore(js, fjs);
})(window, document, 'script',
   'https://cdn-cookieyes.com/widgets/accessibility.js');
</script>