accessibility-plugin-react 2.8.0 → 2.9.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.
package/docs/API.md CHANGED
@@ -50,9 +50,9 @@ Definitions/defaults are immutable for the provider lifetime; the first register
50
50
 
51
51
  Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`, `ToggleControlProps`, `ChoiceControlProps`, `ChoiceOption<T>`, `ChoiceGroup<T>`, `StepperControlProps`, `FeatureCardProps`, `FeatureStatus`, `SearchCountProps`, `EmptyStateProps`, `ErrorStateProps`, `ProfilePreviewCardProps`, `FontSizeControllerProps`, `TextScaleControllerProps`, `TextScaleStep`, `FontFamilyPreset`, `ContrastModeValue`, `ContrastPalette`, `LineHeightControllerProps`, `LetterSpacingControllerProps`, `WordSpacingControllerProps`, `ParagraphSpacingControllerProps`, `ScriptSpacingConstraints`, `SkipToMainLinkProps`, `AccessibilityPreferences`, `ContrastMode`, `CursorSizePreference`, `FontFamilyPreference`, `ProfileDefinition`, `ProfilePresetId`, `ReaderMode`, `SaturationPreference`, `StorageMode`, `TextAlignPreference`, `LocaleStrings`.
52
52
 
53
- Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `SkipToMainLink`.
53
+ Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `ReduceMotionController`, `SkipToMainLink`.
54
54
 
55
- Exported typography, contrast, and reflow utilities: `TEXT_SCALE_STEPS`, `TEXT_SCALE_PROTECTED_SELECTOR`, `isProtectedFromTextScale`, `LINE_HEIGHT_STEPS`, `LINE_HEIGHT_RATIOS`, `TEXT_SPACING_EXCLUDED_SELECTOR`, `isProtectedFromTextSpacing`, `getScriptSpacingConstraints`, `FONT_FAMILY_PRESETS`, `LEGIBLE_FONT_STACK`, `DYSLEXIA_FONT_STACK`, `FONT_FAMILY_PROTECTED_SELECTOR`, `isProtectedFromFontFamily`, `TEXT_ALIGN_BLOCK_SELECTOR`, `isProtectedFromTextAlign`, `CONTRAST_MODES`, `isForcedColorsActive`, `CONTRAST_PROTECTED_SELECTOR`, `isProtectedFromContrast`, `CONTRAST_PALETTES`, `findMainLandmark`.
55
+ Exported typography, contrast, and reflow utilities: `TEXT_SCALE_STEPS`, `TEXT_SCALE_PROTECTED_SELECTOR`, `isProtectedFromTextScale`, `LINE_HEIGHT_STEPS`, `LINE_HEIGHT_RATIOS`, `TEXT_SPACING_EXCLUDED_SELECTOR`, `isProtectedFromTextSpacing`, `getScriptSpacingConstraints`, `FONT_FAMILY_PRESETS`, `LEGIBLE_FONT_STACK`, `DYSLEXIA_FONT_STACK`, `FONT_FAMILY_PROTECTED_SELECTOR`, `isProtectedFromFontFamily`, `TEXT_ALIGN_BLOCK_SELECTOR`, `isProtectedFromTextAlign`, `CONTRAST_MODES`, `isForcedColorsActive`, `subscribeForcedColors`, `isReducedMotionActive`, `subscribeReducedMotion`, `CONTRAST_PROTECTED_SELECTOR`, `isProtectedFromContrast`, `CONTRAST_PALETTES`, `findMainLandmark`.
56
56
 
57
57
  Exported preference and profile utilities: `DEFAULT_PREFERENCES`, `PROFILE_DEFINITIONS`, `normalizePreferences`, `normalizePreferenceValue`, `resolveEffectivePreferences`, `preferencesReducer`, `createInitialPreferencesState`.
58
58
 
@@ -87,7 +87,7 @@ completed. Closing a child issue does not replace the milestone exit review.
87
87
  - [x] [A11Y-203 — Text alignment, legible fonts and language fallback #43](https://github.com/prabothcharith/accessibility-react/issues/43) — Add scoped text alignment and legally distributable readable font choices with Sinhala/Tamil fallbacks while protecting icons, code and symbols.
88
88
  - [x] [A11Y-204 — Contrast modes and native forced-color protection #44](https://github.com/prabothcharith/accessibility-react/issues/44) — Add targeted original/light/dark/high/invert contrast modes that preserve host content and respect forced colors and other native settings.
89
89
  - [x] [A11Y-205 — Link highlighting and focus visibility #45](https://github.com/prabothcharith/accessibility-react/issues/45) — Add non-color-only link cues and stronger focus visibility without removing native indicators or creating unsafe skip links.
90
- - [ ] [A11Y-206 — Reduce motion and best-effort media controls #46](https://github.com/prabothcharith/accessibility-react/issues/46) — Add reduced-motion CSS, tracked Web Animations pausing and explicit media controls while documenting GIF and cross-origin limitations.
90
+ - [x] [A11Y-206 — Reduce motion and best-effort media controls #46](https://github.com/prabothcharith/accessibility-react/issues/46) — Add reduced-motion CSS, tracked Web Animations pausing and explicit media controls while documenting GIF and cross-origin limitations.
91
91
  - [ ] [A11Y-207 — Decorative image handling #47](https://github.com/prabothcharith/accessibility-react/issues/47) — Hide only eligible decorative imagery and keep functional, meaningful, CAPTCHA, chart, map and QR content available.
92
92
  - [ ] [A11Y-208 — Visual regression and performance sweep #48](https://github.com/prabothcharith/accessibility-react/issues/48) — Run cross-feature visual, restoration, repeated-toggle, route, zoom, forced-color, reduced-motion and performance regression sweeps.
93
93
 
package/docs/FEATURES.md CHANGED
@@ -22,6 +22,7 @@ All features are opt-in via controllers, use native buttons, support Enter/Space
22
22
  | FontFamilyController / fontFamily | default; default/legible/dyslexia-option | Applies clean system-ui or OpenDyslexic with Sinhala/Tamil fallbacks. Code blocks, icons, and SVGs are protected. See docs/FONTS.md. |
23
23
  | HideImagesController / hideImages | false; boolean | Hides img/picture with visibility:hidden and removes CSS background images from HTML elements. Layout retained. SVG/canvas/pseudo-element imagery not hidden. |
24
24
  | HideVideosController / hideVideos | false; boolean | Hides video and recognized YouTube/Vimeo embed URL patterns. Does not hide unrelated iframe documents, pause video or mute audio. |
25
+ | ReduceMotionController / reduceMotion | false; boolean | Scoped CSS animation and smooth-scroll suppression, tracked WAAPI animation pausing, and explicit media autoplay pause. Honors OS prefers-reduced-motion. See docs/REDUCE_MOTION.md. |
25
26
  | BigCursorController / bigCursor | false; boolean | 40px high-contrast pointer via SVG cursor with native fallback. Host CSS cursor effects are restored. No effect on touch-only hardware. |
26
27
  | ReadingMaskController / readingMask | false; boolean | Transparent 100px reading window; surrounding screen dimmed. Follows pointer or host focus. |
27
28
  | ReadingGuideController / readingGuide | false; boolean | 4px blue line with white border follows pointer or host focus. Can coexist with mask. |
@@ -0,0 +1,64 @@
1
+ # Reduce Motion and Best-Effort Media Controls
2
+
3
+ This document details the architecture, animation pausing mechanics, media autoplay controls, and technical limitations implemented under **[A11Y-206]**.
4
+
5
+ ---
6
+
7
+ ## 1. Overview and Standards Alignment
8
+
9
+ Vestibular disorders, epilepsy, motion sickness, and attention deficit conditions can be severely triggered by unexpected motion, parallax scrolling, flashing effects, and unprompted video/audio playback.
10
+
11
+ - **WCAG SC 2.2.2 (Pause, Stop, Hide - Level A)**: Any moving, blinking, or scrolling information that starts automatically and lasts more than five seconds must have a mechanism to pause, stop, or hide it.
12
+ - **WCAG SC 2.3.3 (Animation from Interactions - Level AAA)**: Motion animation triggered by interaction can be disabled unless the animation is essential to the functionality or the information being conveyed.
13
+
14
+ ---
15
+
16
+ ## 2. Technical Implementation
17
+
18
+ ### A. Scoped CSS Overrides
19
+
20
+ When `reduceMotion` is active, an isolated style sheet (`#arap-reduce-motion-style`) is injected:
21
+
22
+ ```css
23
+ *:not([data-arap-ui]):not([data-arap-ui] *),
24
+ *:not([data-arap-ui]):not([data-arap-ui] *)::before,
25
+ *:not([data-arap-ui]):not([data-arap-ui] *)::after {
26
+ animation-duration: 0.001ms !important;
27
+ animation-iteration-count: 1 !important;
28
+ transition-duration: 0.001ms !important;
29
+ scroll-behavior: auto !important;
30
+ }
31
+ ```
32
+
33
+ - **0.001ms vs. 0s**: Setting durations to `0.001ms` ensures that standard JavaScript transition/animation lifecycle callbacks (`transitionend`, `animationend`) still dispatch, preventing JavaScript framework state machines from freezing.
34
+ - **Scroll Behavior**: `scroll-behavior: auto !important` instantly terminates animated smooth scrolling.
35
+ - **Widget Boundary Protection**: Elements within `[data-arap-ui]` are excluded so widget open/close and placement operations remain smooth and predictable.
36
+
37
+ ### B. Tracked Web Animations API (WAAPI)
38
+
39
+ - Active animations running via `document.getAnimations()` on host elements are identified and paused:
40
+ ```ts
41
+ if (anim.playState === "running") {
42
+ anim.pause();
43
+ trackedAnimations.add(anim);
44
+ }
45
+ ```
46
+ - **Selective Teardown**: Upon reset or disabling `reduceMotion`, only animations that were originally running and explicitly paused by this plugin are resumed. Animations independently paused by the host application remain paused.
47
+
48
+ ### C. Explicit Media Autoplay Pausing
49
+
50
+ - Host HTML5 `<video>` and `<audio>` elements are queried and paused (`media.pause()`).
51
+ - **Never Autoplay on Reset**: Crucially, when `reduceMotion` is disabled or reset, media playback is **never automatically resumed**. Triggering unexpected sound or video upon resetting accessibility preferences or navigating routes violates user intent.
52
+
53
+ ### D. Operating System Motion Preference
54
+
55
+ - `isReducedMotionActive()` detects whether the host OS has `prefers-reduced-motion: reduce` configured.
56
+ - `subscribeReducedMotion()` listens reactively to changes in the operating system preference.
57
+ - `ReduceMotionController` renders an accessible, polite notice when OS reduced motion is active.
58
+
59
+ ---
60
+
61
+ ## 3. Known Limitations
62
+
63
+ - **Animated GIFs & APNGs**: Standard CSS and DOM APIs cannot halt frame playback within bitmap-encoded animated images without canvas re-rendering or DOM rewriting. Authors should provide static alternatives or use CSS video/animation formats.
64
+ - **Cross-Origin iframes**: Media players embedded inside cross-origin iframes (e.g., standard YouTube, Vimeo, or Spotify embeds) cannot be paused directly via cross-document scripts due to the browser's Same-Origin Policy.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accessibility-plugin-react",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "A composable React display-preference widget with a clean light design, persistent settings and movable accessible controls.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",