accessibility-widgets 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +350 -0
  3. package/package.json +72 -0
  4. package/widget.js +1526 -0
package/README.md ADDED
@@ -0,0 +1,350 @@
1
+ # Accessibility Widget
2
+
3
+ A comprehensive, lightweight accessibility tool that enhances web accessibility for all users. This single-file JavaScript widget provides multiple accessibility features to make websites more usable for people with disabilities.
4
+
5
+ ## Features
6
+
7
+ ### Core Accessibility Features
8
+ - **High Contrast Mode** - Improves visibility for users with low vision
9
+ - **Text Size Adjustment** - Increases font size for better readability
10
+ - **Text Spacing** - Adds letter and word spacing for easier reading
11
+ - **Animation Control** - Pauses animations that may cause distraction or discomfort
12
+ - **Image Hiding** - Removes images for users who prefer text-only content
13
+ - **Dyslexia-Friendly Font** - Uses OpenDyslexic font for users with dyslexia
14
+ - **Cursor Enhancement** - Increases cursor size for better visibility
15
+ - **Line Height Adjustment** - Improves text readability with increased line spacing
16
+ - **Text Alignment** - Forces left alignment for consistent text layout
17
+
18
+ ### Advanced Features
19
+ - **Screen Reader Support** - Built-in text-to-speech functionality
20
+ - **Voice Control** - Voice commands to control accessibility features
21
+ - **Reduced Motion** - Respects user preferences for reduced motion
22
+ - **Font Selection** - Choose between Arial, Times New Roman, and Verdana
23
+ - **Color Blindness Filters** - Filters for Protanopia, Deuteranopia, Tritanopia, and Grayscale
24
+
25
+ ## Installation
26
+
27
+ ### Method 1: Direct Download
28
+ 1. Download the `widget.js` file
29
+ 2. Include it in your HTML page:
30
+
31
+ ```html
32
+ <script src="widget.js"></script>
33
+ ```
34
+
35
+ ### Method 2: NPM
36
+ ```bash
37
+ npm install web-accessibility-widget
38
+ ```
39
+
40
+ ### Method 3: CDN
41
+ ```html
42
+ <script src="https://unpkg.com/web-accessibility-widget@latest/widget.js"></script>
43
+ ```
44
+
45
+ That's it! The widget will automatically initialize when the page loads.
46
+
47
+ ## Configuration
48
+
49
+ The widget is highly customizable. You can override the default settings by defining `window.ACCESSIBILITY_WIDGET_CONFIG` before loading the widget script.
50
+
51
+ ### Basic Configuration
52
+ ```html
53
+ <script>
54
+ // Define your custom configuration
55
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
56
+ // Enable/disable features
57
+ enableVoiceControl: false,
58
+ enableScreenReader: true,
59
+
60
+ // Customize appearance
61
+ widgetWidth: '350px',
62
+ colors: {
63
+ primary: '#0066cc',
64
+ secondary: '#ffffff'
65
+ }
66
+ };
67
+ </script>
68
+ <script src="https://unpkg.com/web-accessibility-widget@latest/widget.js"></script>
69
+ ```
70
+
71
+ ### Complete Configuration Options
72
+ ```html
73
+ <script>
74
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
75
+ // Feature toggles - set to false to disable
76
+ enableHighContrast: true,
77
+ enableBiggerText: true,
78
+ enableTextSpacing: true,
79
+ enablePauseAnimations: true,
80
+ enableHideImages: true,
81
+ enableDyslexiaFont: true,
82
+ enableBiggerCursor: true,
83
+ enableLineHeight: true,
84
+ enableTextAlign: true,
85
+ enableScreenReader: true,
86
+ enableVoiceControl: true,
87
+ enableReducedMotion: true,
88
+ enableFontSelection: true,
89
+ enableColorFilter: true,
90
+
91
+ // Widget dimensions and position
92
+ widgetWidth: '440px',
93
+ widgetPosition: {
94
+ side: 'right', // 'left' or 'right' - which side to position widget
95
+ right: '20px', // distance from right edge when side is 'right'
96
+ left: '20px', // distance from left edge when side is 'left'
97
+ bottom: '20px' // distance from bottom
98
+ },
99
+
100
+ // Color scheme
101
+ colors: {
102
+ primary: '#1e90ff',
103
+ primaryHover: '#00bfff',
104
+ secondary: '#f9f9f9',
105
+ text: '#333',
106
+ textLight: '#fff',
107
+ border: '#e6e6e6',
108
+ borderHover: '#d4d4d4',
109
+ shadow: 'rgba(0, 0, 0, 0.2)',
110
+ focus: '#ff6b35',
111
+ focusGlow: 'rgba(255, 107, 53, 0.3)'
112
+ },
113
+
114
+ // Button styling
115
+ button: {
116
+ size: '55px',
117
+ borderRadius: '1000px',
118
+ iconSize: '28px',
119
+ shadow: '0 4px 8px rgba(0, 0, 0, 0.2)'
120
+ },
121
+
122
+ // Menu styling
123
+ menu: {
124
+ headerHeight: '55px',
125
+ padding: '0 10px 10px 10px',
126
+ optionPadding: '14px 10px',
127
+ optionMargin: '10px',
128
+ borderRadius: '8px',
129
+ fontSize: '16px',
130
+ titleFontSize: '22px',
131
+ closeButtonSize: '44px'
132
+ },
133
+
134
+ // Typography
135
+ typography: {
136
+ fontFamily: 'Arial, sans-serif',
137
+ fontSize: '16px',
138
+ titleFontSize: '22px',
139
+ titleFontWeight: '500',
140
+ lineHeight: '1'
141
+ },
142
+
143
+ // Animation
144
+ animation: {
145
+ transition: '0.2s',
146
+ hoverScale: '1.05'
147
+ },
148
+
149
+ // Language/Text Configuration - Customize all text strings
150
+ lang: {
151
+ accessibilityMenu: 'Accessibility Menu',
152
+ closeAccessibilityMenu: 'Close Accessibility Menu',
153
+ accessibilityTools: 'Accessibility Tools',
154
+ resetAllSettings: 'Reset All Settings',
155
+ screenReader: 'Screen Reader',
156
+ voiceCommand: 'Voice Command',
157
+ textSpacing: 'Text Spacing',
158
+ pauseAnimations: 'Pause Animations',
159
+ hideImages: 'Hide Images',
160
+ dyslexiaFriendly: 'Dyslexia Friendly',
161
+ biggerCursor: 'Bigger Cursor',
162
+ lineHeight: 'Line Height',
163
+ reducedMotion: 'Reduced Motion',
164
+ fontSelection: 'Font Selection',
165
+ colorFilter: 'Color Filter',
166
+ textAlign: 'Text Align',
167
+ textSize: 'Text Size',
168
+ highContrast: 'High Contrast',
169
+ defaultFont: 'Default Font',
170
+ noFilter: 'No Filter',
171
+ default: 'Default',
172
+ close: 'Close',
173
+ screenReaderOn: 'Screen reader on',
174
+ screenReaderOff: 'Screen reader off',
175
+ voiceControlActivated: 'Voice control activated',
176
+ notSupportedBrowser: 'is not supported in this browser'
177
+ }
178
+ };
179
+ </script>
180
+ <script src="https://unpkg.com/web-accessibility-widget@latest/widget.js"></script>
181
+ ```
182
+
183
+ ### Partial Configuration
184
+ You only need to specify the settings you want to change. The widget will merge your settings with the defaults:
185
+
186
+ ```html
187
+ <script>
188
+ // Only override what you need
189
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
190
+ enableVoiceControl: false, // Disable voice control
191
+ widgetWidth: '300px', // Smaller width
192
+ colors: {
193
+ primary: '#purple' // Custom color (other colors remain default)
194
+ }
195
+ };
196
+ </script>
197
+ <script src="widget.js"></script>
198
+ ```
199
+
200
+ ### Widget Positioning
201
+ The widget can be positioned on either side of the screen:
202
+
203
+ ```html
204
+ <script>
205
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
206
+ widgetPosition: {
207
+ side: 'left', // Position on left side of screen
208
+ left: '20px', // 20px from left edge
209
+ bottom: '20px' // 20px from bottom
210
+ }
211
+ };
212
+ </script>
213
+ ```
214
+
215
+ ### Internationalization (i18n)
216
+ The widget supports full internationalization. You can customize all text strings:
217
+
218
+ ```html
219
+ <script>
220
+ // Spanish language example
221
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
222
+ lang: {
223
+ accessibilityMenu: 'Menú de Accesibilidad',
224
+ accessibilityTools: 'Herramientas de Accesibilidad',
225
+ screenReader: 'Lector de Pantalla',
226
+ biggerText: 'Texto Más Grande',
227
+ highContrast: 'Alto Contraste',
228
+ resetAllSettings: 'Restablecer Todas las Configuraciones',
229
+ close: 'Cerrar'
230
+ // ... add more translations as needed
231
+ }
232
+ };
233
+ </script>
234
+ ```
235
+
236
+ ## Voice Commands
237
+
238
+ When voice control is enabled, users can activate features using these commands:
239
+
240
+ - "show menu" / "open menu" - Opens the accessibility menu
241
+ - "high contrast" - Toggles high contrast mode
242
+ - "bigger text" - Toggles larger text size
243
+ - "text spacing" - Toggles text spacing
244
+ - "pause animations" - Toggles animation pausing
245
+ - "hide images" - Toggles image hiding
246
+ - "dyslexia font" - Toggles dyslexia-friendly font
247
+ - "bigger cursor" - Toggles larger cursor
248
+ - "screen reader" - Toggles screen reader
249
+ - "reset all" - Resets all accessibility settings
250
+
251
+ ## Browser Compatibility
252
+
253
+ - **Modern Browsers**: Full functionality in Chrome, Firefox, Safari, Edge
254
+ - **Screen Reader**: Requires Speech Synthesis API support
255
+ - **Voice Control**: Requires Speech Recognition API support
256
+ - **Graceful Degradation**: Features that aren't supported are automatically disabled
257
+
258
+ ## Technical Features
259
+
260
+ - **Single File Deployment** - No dependencies, just include one JavaScript file
261
+ - **Persistent Settings** - User preferences saved in localStorage
262
+ - **Keyboard Navigation** - Full keyboard accessibility with Tab, Arrow keys, and Escape
263
+ - **ARIA Compliance** - Proper ARIA labels and roles for screen readers
264
+ - **Performance Optimized** - DOM caching and efficient event handling
265
+ - **Error Handling** - Robust error handling for browser compatibility
266
+ - **Responsive Design** - Works on desktop and mobile devices
267
+ - **Flexible Positioning** - Support for left/right side positioning
268
+ - **Full Internationalization** - Complete text customization for any language
269
+ - **Configurable Colors** - Dynamic color theming including SVG icon colors
270
+ - **Screen Reader Optimized** - Proper text labels for all interactive elements
271
+
272
+ ## Usage Examples
273
+
274
+ ### Basic Implementation
275
+ ```html
276
+ <!DOCTYPE html>
277
+ <html>
278
+ <head>
279
+ <title>My Accessible Website</title>
280
+ </head>
281
+ <body>
282
+ <h1>Welcome to My Website</h1>
283
+ <p>This site includes accessibility features.</p>
284
+
285
+ <!-- Include the widget -->
286
+ <script src="widget.js"></script>
287
+ </body>
288
+ </html>
289
+ ```
290
+
291
+ ### Custom Configuration
292
+ ```html
293
+ <script>
294
+ // Define custom settings before loading the widget
295
+ window.ACCESSIBILITY_WIDGET_CONFIG = {
296
+ enableVoiceControl: false, // Disable voice control
297
+ widgetWidth: '300px', // Smaller menu width
298
+ colors: {
299
+ primary: '#0066cc', // Custom blue color
300
+ secondary: '#ffffff' // White background
301
+ }
302
+ };
303
+ </script>
304
+ <script src="https://unpkg.com/web-accessibility-widget@latest/widget.js"></script>
305
+ ```
306
+
307
+ ## Accessibility Standards
308
+
309
+ This widget helps websites comply with:
310
+ - **WCAG 2.1** (Web Content Accessibility Guidelines)
311
+ - **Section 508** (US Federal accessibility requirements)
312
+ - **ADA** (Americans with Disabilities Act) digital accessibility standards
313
+
314
+ ## File Structure
315
+
316
+ ```
317
+ widget/
318
+ ├── widget.js # Main accessibility widget file
319
+ ├── index.html # Demo/test page
320
+ └── README.md # This documentation
321
+ ```
322
+
323
+ ## Contributing
324
+
325
+ When contributing to this project:
326
+
327
+ 1. Test all features across different browsers
328
+ 2. Ensure keyboard navigation works properly
329
+ 3. Verify screen reader compatibility
330
+ 4. Test voice commands (if supported by browser)
331
+ 5. Check that settings persist across page reloads
332
+
333
+ ## License
334
+
335
+ This project is open source and available under the GPL License.
336
+
337
+ ## Support
338
+
339
+ For support or feature requests, please check the browser console for any error messages and ensure your browser supports the required APIs for advanced features like speech synthesis and recognition.
340
+
341
+ ## Recent Changes
342
+
343
+ ### Latest Updates
344
+ - **Widget Positioning**: Added support for left/right side positioning with configurable distances
345
+ - **Internationalization**: Full i18n support with customizable text strings for all languages
346
+ - **Color Theming**: SVG icons now use configurable primary color instead of hardcoded values
347
+ - **Screen Reader Improvements**: Fixed close button text to read properly ("Close" instead of "times")
348
+ - **Removed Features**: Removed Reading Mode and Enhanced Focus features for better performance
349
+ - **UI Improvements**: Updated header background to black, removed gradient from accessibility button
350
+ - **Configuration**: Enhanced configuration system with deep merging for partial overrides
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "accessibility-widgets",
3
+ "version": "1.0.0",
4
+ "description": "A comprehensive, lightweight accessibility widget that enhances web accessibility for all users. Provides multiple accessibility features including screen reader support, voice control, high contrast mode, and more.",
5
+ "main": "widget.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "echo \"No build process required - single file widget\"",
9
+ "dev": "python -m http.server 8000 || python3 -m http.server 8000 || npx http-server -p 8000",
10
+ "lint": "echo \"No linting configured\"",
11
+ "prepublishOnly": "echo \"Preparing package for publishing...\""
12
+ },
13
+ "keywords": [
14
+ "accessibility",
15
+ "a11y",
16
+ "widget",
17
+ "wcag",
18
+ "ada",
19
+ "section508",
20
+ "screen-reader",
21
+ "voice-control",
22
+ "high-contrast",
23
+ "dyslexia",
24
+ "colorblind",
25
+ "disabilities",
26
+ "inclusive",
27
+ "web-accessibility",
28
+ "javascript",
29
+ "frontend",
30
+ "ui",
31
+ "ux",
32
+ "assistive-technology"
33
+ ],
34
+ "author": {
35
+ "name": "Your Name",
36
+ "email": "your.email@example.com",
37
+ "url": "https://your-website.com"
38
+ },
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/yourusername/web-accessibility-widget.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/yourusername/web-accessibility-widget/issues"
46
+ },
47
+ "homepage": "https://github.com/yourusername/web-accessibility-widget#readme",
48
+ "files": [
49
+ "widget.js",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "engines": {
54
+ "node": ">=12.0.0"
55
+ },
56
+ "browserslist": [
57
+ "> 1%",
58
+ "last 2 versions",
59
+ "not dead",
60
+ "not ie 11"
61
+ ],
62
+ "devDependencies": {},
63
+ "dependencies": {},
64
+ "peerDependencies": {},
65
+ "funding": {
66
+ "type": "github",
67
+ "url": "https://github.com/sponsors/yourusername"
68
+ },
69
+ "jsdelivr": "widget.js",
70
+ "unpkg": "widget.js",
71
+ "cdn": "widget.js"
72
+ }