A comprehensive, lightweight, self-contained accessibility plugin that provides extensive customization options including text-to-speech, color blindness filters, and many other accessibility features. Perfect for shared web servers as it requires no server-side configuration.
The Accessibility Widget is designed to make websites more inclusive and accessible to all users, regardless of their abilities or disabilities. With 20+ accessibility features, this plugin helps websites comply with WCAG (Web Content Accessibility Guidelines) and provides users with the tools they need to customize their browsing experience.
- β Zero Dependencies - Pure JavaScript and CSS
- β Lightweight - Minimal performance impact
- β Easy Integration - Works with any HTML/PHP page
- β Fully Customizable - Extensive configuration options
- β Mobile Friendly - Responsive design for all devices
- β Open Source - Free to use and modify
- β WCAG Compliant - Follows accessibility best practices
The plugin offers comprehensive text customization options to help users with reading difficulties, dyslexia, or visual impairments:
-
Font Size Adjustment:
- 75% (Small) - For users who prefer compact text
- 100% (Normal) - Default size
- 125% (Large) - Slightly larger for easier reading
- 150% (Extra Large) - Significantly larger text
- 200% (Huge) - Maximum size for severe visual impairments
-
Contrast Modes:
- Normal: Standard contrast
- High Contrast: Enhanced contrast for low vision users
- Dark Mode: Dark background with light text to reduce eye strain
-
Line Height:
- Normal spacing for standard reading
- Large spacing for users who need more vertical space between lines
-
Letter Spacing:
- Normal spacing for standard text
- Wide spacing to help users with dyslexia distinguish letters better
-
Font Family Options:
- Default: Uses the website's default font
- Sans Serif: Clean, modern fonts like Arial or Helvetica
- Serif: Traditional fonts like Times New Roman
- Monospace: Fixed-width fonts like Courier
Comprehensive color vision support for users with various types of color blindness:
-
Color Blindness Filters:
- Protanopia (Red-Blind): Simulates red-green color blindness where red appears darker
- Deuteranopia (Green-Blind): Simulates red-green color blindness where green appears darker
- Tritanopia (Blue-Blind): Simulates blue-yellow color blindness
- Achromatopsia (Total Color Blind): Converts everything to grayscale
-
High Contrast Mode: Increases contrast between text and background for better visibility
Advanced reading assistance tools for users with reading difficulties:
-
Text-to-Speech (TTS):
- Read selected text aloud
- Read entire page content (first 5000 characters)
- Adjustable speech rate (0.5x to 2.0x speed)
- Adjustable pitch (0 to 2.0)
- Adjustable volume (0 to 1.0)
- Multiple voice support (browser-dependent)
- Word-by-word highlighting as text is read
-
Reading Guide:
- Visual guide line that follows your cursor
- Helps with tracking while reading long passages
- Customizable height and color
-
Reading Mask:
- Hides text below the reading position
- Reduces distractions while reading
- Adjustable mask height (3 lines default)
-
Text Highlight:
- Highlights text as you read
- Helps maintain focus on current reading position
-
Image Alt Text Display:
- Shows image descriptions (alt text) when hovering over images
- Helps users understand image content
Essential accessibility features for users with various needs:
-
Enhanced Focus Indicator:
- High-contrast focus outlines for keyboard navigation
- Makes it clear which element has focus
- Essential for keyboard-only users
-
Stop Animations:
- Disables all CSS animations and transitions
- Reduces motion for users with vestibular disorders
- Helps prevent motion sickness
-
Underline All Links:
- Makes all links clearly visible with underlines
- Helps users identify clickable elements
- Improves link visibility
-
Persistent Settings:
- Uses browser localStorage to remember user preferences
- Settings persist across page reloads
- Per-domain storage
-
Keyboard Navigation:
- Full keyboard support
- Tab navigation through all controls
- Enter/Space to activate buttons
- Escape to close panels
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Configurable: Easy to customize via config file
- No Dependencies: Pure JavaScript and CSS, no frameworks required
- Lightweight: Minimal performance impact
- Cross-Browser: Works on all modern browsers
- Print-Friendly: Widget is hidden when printing
Use jsDelivr CDN for easy installation without hosting files yourself:
<!-- Include Boxicons for icons (required) -->
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">
<!-- Include the CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/website-accessibility-filter@latest/accessibility-plugin.css">
<!-- Include the config (optional - customize as needed) -->
<script src="https://cdn.jsdelivr.net/npm/website-accessibility-filter@latest/accessibility-config.js"></script>
<!-- Include the plugin (must be loaded last) -->
<script src="https://cdn.jsdelivr.net/npm/website-accessibility-filter@latest/accessibility-plugin.js"></script><!-- Include Boxicons for icons (required) -->
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">
<!-- Include the CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/airforcerp/Website-Accessibility-Widget@latest/accessibility-plugin.css">
<!-- Include the config (optional - customize as needed) -->
<script src="https://cdn.jsdelivr.net/gh/airforcerp/Website-Accessibility-Widget@latest/accessibility-config.js"></script>
<!-- Include the plugin (must be loaded last) -->
<script src="https://cdn.jsdelivr.net/gh/airforcerp/Website-Accessibility-Widget@latest/accessibility-plugin.js"></script>Note: Replace @latest with a specific version tag (e.g., @1.0.0) for production use to ensure stability.
-
Upload the following files to your web server:
accessibility-plugin.jsaccessibility-plugin.cssaccessibility-config.js
-
Include the files in your HTML or PHP pages:
<!-- Include Boxicons for icons (required) -->
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">
<!-- Include the CSS -->
<link rel="stylesheet" href="path/to/accessibility-plugin.css">
<!-- Include the config -->
<script src="path/to/accessibility-config.js"></script>
<!-- Include the plugin (must be loaded last) -->
<script src="path/to/accessibility-plugin.js"></script>Edit accessibility-config.js to customize the plugin:
var AccessibilityConfig = {
position: 'bottom-right', // 'bottom-left' or 'bottom-right'
buttonText: 'Accessibility', // Text on the toggle button
showReset: true, // Show reset button (true/false)
fontSize: 100, // Default font size percentage
contrast: 'normal', // 'normal', 'high', or 'dark'
lineHeight: 'normal', // 'normal' or 'large'
letterSpacing: 'normal', // 'normal' or 'wide'
fontFamily: 'default', // 'default', 'sans-serif', 'serif', 'monospace'
colorBlindness: 'none', // 'none', 'protanopia', 'deuteranopia','tritanopia', 'achromatopsia'
focusIndicator: false, // Enable focus indicator (true/false)
readingGuide: false, // Enable reading guide (true/false)
stopAnimations: false, // Stop animations (true/false)
underlineLinks: false, // Underline all links (true/false)
showImageAlt: false, // Show image alt text (true/false)
ttsEnabled: false, // Enable text-to-speech (true/false)
ttsRate: 1.0, // TTS speech rate (0.5 to 2.0)
ttsPitch: 1.0, // TTS pitch (0 to 2.0)
ttsVolume: 1.0 // TTS volume (0 to 1.0)
};If you don't include the config file, the plugin will use default settings.
<!DOCTYPE html>
<html>
<head>
<!-- Include Boxicons for icons (required) -->
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">
<!-- Include the CSS -->
<link rel="stylesheet" href="accessibility-plugin.css">
<!-- Include the config -->
<script src="accessibility-config.js"></script>
<!-- Include the plugin (must be loaded last) -->
<script src="accessibility-plugin.js"></script>
</head>
<body>
<!-- Your content here -->
</body>
</html><!DOCTYPE html>
<html>
<head>
<!-- Include Boxicons for icons (required) -->
<link rel="stylesheet" href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css">
<!-- Include the CSS -->
<link rel="stylesheet" href="accessibility-plugin.css">
<!-- Include the config -->
<script src="accessibility-config.js"></script>
<!-- Include the plugin (must be loaded last) -->
<script src="accessibility-plugin.js"></script>
</head>
<body>
<?php
// Your PHP content here
?>
</body>
</html>Add to your theme's functions.php:
function add_accessibility_plugin() {
wp_enqueue_style('accessibility-plugin', get_template_directory_uri() . '/accessibility-plugin.css');
wp_enqueue_script('accessibility-config', get_template_directory_uri() . '/accessibility-config.js', array(), '1.0', false);
wp_enqueue_script('accessibility-plugin', get_template_directory_uri() . '/accessibility-plugin.js', array(), '1.0', true);
}
add_action('wp_enqueue_scripts', 'add_accessibility_plugin');The plugin exposes a global AccessibilityPlugin object for programmatic control. This allows you to integrate accessibility features into your own JavaScript code.
Opens or closes the accessibility panel.
// Toggle the panel
AccessibilityPlugin.toggle();Resets all settings to their default values.
// Reset to default settings
AccessibilityPlugin.reset();Returns an object containing all current accessibility settings.
// Get current settings
const settings = AccessibilityPlugin.getSettings();
console.log(settings);
// Output: { fontSize: 100, contrast: 'normal', colorBlindness: 'none', ... }Sets the font size percentage.
Parameters:
size(number): Font size percentage. Valid values: 75, 100, 125, 150, or 200
// Set font size to 150%
AccessibilityPlugin.setFontSize(150);
// Set font size to 200% (huge)
AccessibilityPlugin.setFontSize(200);Sets the contrast mode.
Parameters:
mode(string): Contrast mode. Valid values: 'normal', 'high', or 'dark'
// Set high contrast mode
AccessibilityPlugin.setContrast('high');
// Set dark mode
AccessibilityPlugin.setContrast('dark');
// Return to normal contrast
AccessibilityPlugin.setContrast('normal');Sets the color blindness filter.
Parameters:
type(string): Color blindness type. Valid values: 'none', 'protanopia', 'deuteranopia', 'tritanopia', 'achromatopsia'
// Apply protanopia filter
AccessibilityPlugin.setColorBlindness('protanopia');
// Apply deuteranopia filter
AccessibilityPlugin.setColorBlindness('deuteranopia');
// Remove color blindness filter
AccessibilityPlugin.setColorBlindness('none');Speaks the provided text using text-to-speech.
Parameters:
text(string): The text to be spoken
// Speak custom text
AccessibilityPlugin.speak('Hello, this is text-to-speech');
// Speak page content
AccessibilityPlugin.speak(document.body.innerText);Stops the current text-to-speech playback.
// Stop speaking
AccessibilityPlugin.stopSpeaking();// Check if user prefers larger text
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
AccessibilityPlugin.setFontSize(125);
}// Detect if user prefers high contrast
if (window.matchMedia('(prefers-contrast: high)').matches) {
AccessibilityPlugin.setContrast('high');
}// Create a custom button that toggles accessibility
document.getElementById('myAccessibilityBtn').addEventListener('click', function() {
AccessibilityPlugin.toggle();
});
// Create a button to increase font size
document.getElementById('increaseFontBtn').addEventListener('click', function() {
const current = AccessibilityPlugin.getSettings();
const sizes = [75, 100, 125, 150, 200];
const currentIndex = sizes.indexOf(current.fontSize);
if (currentIndex < sizes.length - 1) {
AccessibilityPlugin.setFontSize(sizes[currentIndex + 1]);
}
});// Save user preferences
function savePreferences() {
const settings = AccessibilityPlugin.getSettings();
localStorage.setItem('accessibilityPrefs', JSON.stringify(settings));
}
// Restore user preferences
function restorePreferences() {
const saved = localStorage.getItem('accessibilityPrefs');
if (saved) {
const settings = JSON.parse(saved);
AccessibilityPlugin.setFontSize(settings.fontSize);
AccessibilityPlugin.setContrast(settings.contrast);
AccessibilityPlugin.setColorBlindness(settings.colorBlindness);
}
}
// Call on page load
window.addEventListener('load', restorePreferences);The Accessibility Widget is tested and works on the following browsers:
- β Chrome 90+ (Full support)
- β Edge 90+ (Full support)
- β Firefox 88+ (Full support)
- β Safari 14+ (Full support)
β οΈ Opera 76+ (Full support, Chromium-based)
- β iOS Safari 14+ (Full support)
- β Chrome Mobile (Android) (Full support)
- β Samsung Internet (Full support)
- β Firefox Mobile (Full support)
| Feature | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| Font Size | β | β | β | β |
| Contrast Modes | β | β | β | β |
| Color Blindness Filters | β | β | β | β |
| Text-to-Speech | β | β | β | β |
| Reading Guide | β | β | β | β |
| Reading Mask | β | β | β | β |
| Focus Indicator | β | β | β | β |
| Stop Animations | β | β | β | β |
| Persistent Settings | β | β | β | β |
- Text-to-Speech: Requires browser support for Web Speech API. Best support in Chrome, Edge, and Safari. Firefox has limited TTS support.
- Color Blindness Filters: Uses SVG filters which may have slight performance impact on very large pages in older browsers.
- localStorage: All modern browsers support localStorage. Older browsers (IE10 and below) may not support it.
accessibility-plugin/
βββ web/
β βββ accessibility-plugin.js # Main plugin logic (1618 lines)
β βββ accessibility-plugin.css # Plugin styles (885 lines)
β βββ accessibility-config.js # Configuration file
β βββ example.html # HTML example
β βββ example-php.php # PHP example
βββ index.html # Demo/landing page
βββ README.md # This file (main documentation)
βββ RELEASE_NOTES.md # Release notes
βββ CHANGELOG.md # Version changelog
βββ JSDELIVR-SETUP.md # CDN setup instructions
- accessibility-plugin.js: Contains all the plugin logic, including widget creation, settings management, TTS functionality, and color blindness filters.
- accessibility-plugin.css: Contains all styles for the widget, panel, and accessibility features.
- accessibility-config.js: Configuration file that allows you to customize default settings.
- example.html: Complete HTML example showing how to integrate the plugin.
- example-php.php: Complete PHP example showing how to integrate the plugin in PHP pages.
- index.html: Beautiful demo/landing page showcasing all features.
You can customize the appearance of the widget by editing the CSS file or adding custom CSS:
.accessibility-toggle-btn {
background: #0066cc; /* Change button color */
color: #ffffff; /* Change text color */
}
.accessibility-toggle-btn:hover {
background: #0052a3; /* Change hover color */
}.accessibility-panel-header {
background: #0066cc; /* Change header color */
color: #ffffff; /* Change header text color */
}.accessibility-panel {
background: #ffffff; /* Change panel background */
}
.accessibility-panel-content {
background: #f9f9f9; /* Change content background */
}You can change the widget position via CSS:
/* Move to top-right */
.accessibility-widget {
top: 20px !important;
right: 20px !important;
bottom: auto !important;
}
/* Move to top-left */
.accessibility-widget {
top: 20px !important;
left: 20px !important;
right: auto !important;
bottom: auto !important;
}Edit accessibility-config.js to change default settings:
var AccessibilityConfig = {
position: 'bottom-right', // Widget position
buttonText: 'Accessibility', // Button text
showReset: true, // Show reset button
fontSize: 125, // Default to larger text
contrast: 'high', // Default to high contrast
// ... more options
};To add custom accessibility options, you'll need to modify accessibility-plugin.js:
- Add to defaultSettings:
const defaultSettings = {
// ... existing settings
myCustomOption: false, // Add your custom option
};- Add to currentState:
let currentState = {
// ... existing state
myCustomOption: settings.myCustomOption,
};- Add UI control in createWidget():
// Add your control to the widget panel
const myControl = createControl('My Custom Option', 'myCustomOption', [
{ value: false, label: 'Off' },
{ value: true, label: 'On' }
], currentState.myCustomOption);- Implement logic in applySettings():
function applySettings() {
// ... existing settings
if (currentState.myCustomOption) {
// Your custom logic here
document.body.classList.add('my-custom-class');
} else {
document.body.classList.remove('my-custom-class');
}
}You can create custom themes by overriding CSS variables (if supported) or by directly modifying the CSS classes:
/* Custom theme example */
.accessibility-widget {
--primary-color: #8b5cf6;
--primary-hover: #7c3aed;
}
.accessibility-toggle-btn {
background: var(--primary-color);
}
.accessibility-toggle-btn:hover {
background: var(--primary-hover);
}For Users:
- Enable TTS in the plugin panel by toggling the "Text-to-Speech" option
- Select any text on the page and click "Read Selected Text" to hear it
- Click "Read Selected Text" without selecting text to read the entire page (first 5000 characters)
- Click "Stop Reading" to stop the current speech
- Adjust speech rate, pitch, and volume in the TTS settings
For Developers:
- TTS works best in Chrome, Edge, and Safari
- Firefox has limited TTS support
- TTS requires user interaction (can't auto-play)
- Maximum text length is 5000 characters for full page reading
For Users:
- Enable the reading guide to get a visual line that follows your cursor
- Helps with tracking while reading long passages
- Particularly useful for users with dyslexia or attention disorders
- The guide line is customizable in height and color
For Developers:
- The reading guide uses CSS transforms for smooth movement
- It's positioned absolutely and follows mouse movement
- Can be disabled via CSS if needed
For Users:
- Choose from different color blindness types to see how the page appears
- Useful for understanding how color-dependent content looks
- Filters are applied in real-time
- Can be combined with other accessibility features
For Developers:
- Filters use SVG filters which may impact performance on very large pages
- Consider testing your site with different filters during development
- Ensure important information doesn't rely solely on color
- Use patterns, icons, or text labels in addition to color
Best Practices:
- Test your layout with all font sizes (75% to 200%)
- Ensure text doesn't overflow containers at larger sizes
- Use relative units (em, rem) instead of fixed pixels
- Test responsive breakpoints with different font sizes
High Contrast Mode:
- Increases contrast between text and background
- Essential for users with low vision
- Test your site in high contrast mode during development
Dark Mode:
- Reduces eye strain in low-light conditions
- Popular among users with light sensitivity
- Ensure your content is readable in dark mode
- Lazy Loading: The plugin loads on page load. For better performance, consider lazy loading on user interaction.
- CDN Usage: Use the CDN version for better caching and performance.
- Minification: For production, consider minifying the JavaScript and CSS files.
- Filter Performance: Color blindness filters may impact performance on pages with many images. Consider optimizing images.
- Don't Rely on Color Alone: Use color in combination with icons, patterns, or text.
- Keyboard Navigation: Ensure all functionality is accessible via keyboard.
- Focus Indicators: The plugin provides enhanced focus indicators - don't disable them.
- Alt Text: Always provide meaningful alt text for images.
- Semantic HTML: Use proper HTML semantics for better screen reader support.
- Testing: Test your site with various accessibility features enabled.
- Settings are saved in browser localStorage
- Settings are per-domain (each website has its own settings)
- Users can clear settings by clearing browser data
- Settings persist across page reloads and browser sessions
- The plugin works on any HTML/PHP page without server-side requirements
- All styles are scoped to avoid conflicts with existing page styles
- The widget is hidden when printing (via CSS media queries)
- TTS requires browser support for Web Speech API (Chrome, Edge, Safari)
- Color blindness filters use SVG filters and may have slight performance impact on very large pages
- The plugin uses only client-side JavaScript
- No data is sent to external servers
- All settings are stored locally in the browser
- The plugin is safe to use on any website
- Minimal performance impact (< 50KB total file size)
- Lazy initialization (only loads when needed)
- Efficient CSS selectors
- Optimized JavaScript code
Problem: The widget button doesn't appear on the page.
Solutions:
- Check that all files are loaded correctly (check browser console for errors)
- Ensure Boxicons CSS is loaded before the plugin CSS
- Verify that
accessibility-plugin.jsis loaded last - Check for JavaScript errors in the browser console
- Ensure no other scripts are conflicting
Problem: TTS doesn't speak or shows an error.
Solutions:
- Check browser compatibility (Chrome, Edge, Safari work best)
- Ensure TTS is enabled in the plugin panel
- Check browser permissions for speech synthesis
- Try selecting text before clicking "Read Selected Text"
- Check browser console for error messages
Problem: Settings reset when the page reloads.
Solutions:
- Check if localStorage is enabled in the browser
- Check browser console for localStorage errors
- Ensure cookies/localStorage aren't blocked
- Try in a different browser to isolate the issue
Problem: Color blindness filter doesn't apply or causes issues.
Solutions:
- Check browser compatibility (modern browsers required)
- Ensure SVG filters are supported
- Check for CSS conflicts
- Try disabling other filters/effects
- Check browser console for errors
Problem: Widget disappears when color blindness filters are applied.
Solutions:
- This is a known issue that has been fixed in recent versions
- Ensure you're using the latest version of the plugin
- Check that custom CSS isn't interfering
- The widget should remain visible with proper CSS isolation
Problem: Page becomes slow with the plugin enabled.
Solutions:
- Disable color blindness filters if not needed
- Use CDN version for better caching
- Check for conflicts with other scripts
- Consider lazy loading the plugin
- Optimize images on your page
A: Yes! The plugin is completely free to use and modify for any purpose.
A: No, you can use the CDN version which doesn't require hosting the files yourself.
A: Yes! See the WordPress integration section in the README.
A: Yes! You can customize colors, position, and styling via CSS or the config file.
A: Yes! The plugin is fully responsive and works on all mobile devices.
A: No, the plugin is lightweight and has minimal performance impact.
A: Yes, the plugin helps websites comply with WCAG 2.1 guidelines.
A: Yes, you can use it on as many websites as you want.
A: No, it's completely client-side and requires no server configuration.
A: Yes! The code is open source and you're free to modify it.
A: Please open an issue on GitHub or email accessibility@airforcerp.com
We welcome contributions! Here's how you can help:
- Report Bugs: Open an issue on GitHub with detailed information
- Suggest Features: Share your ideas for new features
- Submit Pull Requests: Contribute code improvements
- Improve Documentation: Help make the docs better
- Share: Tell others about the plugin
- Clone the repository
- Open
example.htmlin a browser - Make your changes
- Test thoroughly
- Submit a pull request
- WCAG 2.1 Guidelines
- Web Accessibility Initiative
- Web Speech API Documentation
- Color Blindness Information
Free to use and modify for any purpose.
This means you can:
- β Use it commercially
- β Modify it
- β Distribute it
- β Use it privately
- β Use it in open source projects
- β Use it in proprietary projects
No attribution required, but appreciated!
Created by: AirforceRP
GitHub Repository: https://github.com/airforcerp/Website-Accessibility-Widget
For issues, questions, or suggestions:
- GitHub Issues: Open an issue
- Email: accessibility@airforcerp.com
- Documentation: Check the code comments in the JavaScript file for detailed explanations
If you find this plugin useful, please consider giving it a star on GitHub! It helps others discover the project.
Thank you for using the Accessibility Widget!
Making the web accessible for everyone, one website at a time. πβΏ
Last updated: November 2025