Managing Features

A11yCore provides a JavaScript API to programmatically control accessibility features. All methods returntrueon success orfalseif the feature key is not recognized.

Core Methods

A11yCore.features.enable('featureName')Enable a feature by key. Returns boolean.
A11yCore.features.disable('featureName')Disable a feature by key. Returns boolean.
A11yCore.features.toggle('featureName')Toggle a feature on/off. Returns boolean.
A11yCore.features.colorFilter('monochrome')Apply color filter: 'invert', 'monochrome', 'protanopia', 'deuteranopia', 'tritanopia'
A11yCore.features.spacing(2)Set text spacing level: 0 (reset), 1, 2, 3
A11yCore.features.transcript()Show transcript overlay for media elements

Available Feature Keys

These are the exact feature keys accepted byenable(),disable(), andtoggle():

KeyDescription
highContrastForce a high-contrast color scheme
keyboardNavAdd skip link and strong focus styles
ariaInjectorInject ARIA labels for unlabeled elements
textSize:120Resize text to 120% (also 130, 140, 150, 200)
readingGuideHorizontal line following pointer/focus
readingMaskDim surroundings with focus window
reduceMotionDisable animations and smooth scrolling
accessibleFontUse dyslexia-friendly font stack
darkModeApply dark theme with adjusted colors
largeCursorLarge, high-contrast SVG cursor
highlightHeadingsVisually emphasize all headings
hitTargetsIncrease minimum target size (44x44px)
landmarksAdd skip-to-content and semantic landmarks
tocShow Table of Contents overlay
altSuggestSuggest alt text for images
contrastAdjustEnforce minimum contrast ratio (AA)
contrastAdjustAAAEnforce AAA contrast ratio
hoverDisablePause animations on hover
captionsEnable caption tracks for media
formAssistAdd labels, validation, error announcements
simplifyTextClean layout, limit content width
tabOrderNormalize tabindex to follow DOM order
focusAssistKeep focused element visible
muteMediaMute and pause all audio/video
labelInNameEnsure visible text in aria-label
inputPurposeAdd autocomplete to form inputs
singleKeyBlockBlock single-character shortcuts
redundantEntryReuse previously entered values
timeoutAssistSimulate activity to avoid timeouts
flashGuardMitigate rapid flashing animations
motionActuationBlock device motion events
langAssistSet missing lang/dir attributes
titleAssistSet missing document title
pointerCancellationPointer cancellation support
dragAlternativeProvide drag alternatives
linkPurposeEnhance link purpose clarity
headingHierarchyAnalyze and fix heading hierarchy

Feature Events

A11yCore emits events when features are enabled or disabled. Use these for analytics or UI synchronization.

// Listen for feature enable
A11yCore.on('featureEnabled', (featureName) => {
  console.log('Feature enabled:', featureName);
  analytics.track('a11y_feature_enabled', { feature: featureName });
});

// Listen for feature disable
A11yCore.on('featureDisabled', (featureName) => {
  console.log('Feature disabled:', featureName);
});

// Remove listener
A11yCore.off('featureEnabled', myHandler);

Events fire whenever feature state changes, whether from API calls or user interactions with the widget.