accessibility-plugin-react 2.8.0 → 2.10.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/README.md CHANGED
@@ -88,27 +88,27 @@ export function App() {
88
88
  Every controller is opt-in. Add only the controls that make sense for your
89
89
  site, and choose their order in JSX.
90
90
 
91
- | Controller | Effect |
92
- | ------------------------- | ------------------------------------------------------------------------------------------------------------ |
93
- | `TextScaleController` | Stepwise reflow-safe text enlargement (1.0x, 1.125x, 1.25x, 1.5x, 2.0x) protecting forms, code, and icons. |
94
- | `FontSizeController` | Scales eligible HTML text from 50% to 200%; supports continuous 10% steps or `stepScale` mode. |
95
- | `LineHeightController` | Scales computed line height (50%–200%, step 10); supports `stepPresets` (100%, 150%, 175%, 200%). |
96
- | `LetterSpacingController` | Applies 0–10px letter spacing with automatic cursive (Arabic/RTL) and Indic (Sinhala/Tamil) protection. |
97
- | `WordSpacingController` | Applies 0–10px word spacing while protecting tables, code, forms, and widget internals. |
98
- | `ContrastController` | Adjusts contrast levels, palettes, or semantic modes while preserving images, video, charts, and validation. |
99
- | `ContrastModeController` | Applies light, dark, high contrast, or media-safe invert tokens with native forced-colors protection. |
100
- | `SaturationController` | Reduces or increases saturation. |
101
- | `InvertColorsController` | Inverts eligible page content. |
102
- | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
103
- | `LinkHighlightController` | Highlights links or selects a link palette. |
104
- | `TextAlignController` | Scopes left, center, right, or justified alignment to text blocks; warns about justification. |
105
- | `FontFamilyController` | Applies clean system-ui or OpenDyslexic with Sinhala/Tamil fallbacks while protecting code and icons. |
106
- | `HideImagesController` | Hides images and CSS background images while retaining layout. |
107
- | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
108
- | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
109
- | `ReadingMaskController` | Dims the page around a transparent reading window. |
110
- | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
111
- | `ResetController` | Resets display features and custom registered features without moving the widget. |
91
+ | Controller | Effect |
92
+ | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
93
+ | `TextScaleController` | Stepwise reflow-safe text enlargement (1.0x, 1.125x, 1.25x, 1.5x, 2.0x) protecting forms, code, and icons. |
94
+ | `FontSizeController` | Scales eligible HTML text from 50% to 200%; supports continuous 10% steps or `stepScale` mode. |
95
+ | `LineHeightController` | Scales computed line height (50%–200%, step 10); supports `stepPresets` (100%, 150%, 175%, 200%). |
96
+ | `LetterSpacingController` | Applies 0–10px letter spacing with automatic cursive (Arabic/RTL) and Indic (Sinhala/Tamil) protection. |
97
+ | `WordSpacingController` | Applies 0–10px word spacing while protecting tables, code, forms, and widget internals. |
98
+ | `ContrastController` | Adjusts contrast levels, palettes, or semantic modes while preserving images, video, charts, and validation. |
99
+ | `ContrastModeController` | Applies light, dark, high contrast, or media-safe invert tokens with native forced-colors protection. |
100
+ | `SaturationController` | Reduces or increases saturation. |
101
+ | `InvertColorsController` | Inverts eligible page content. |
102
+ | `GrayscaleController` | Removes color while preserving the selected saturation value for later. |
103
+ | `LinkHighlightController` | Highlights links or selects a link palette. |
104
+ | `TextAlignController` | Scopes left, center, right, or justified alignment to text blocks; warns about justification. |
105
+ | `FontFamilyController` | Applies clean system-ui or OpenDyslexic with Sinhala/Tamil fallbacks while protecting code and icons. |
106
+ | `HideImagesController` / `HideDecorativeImagesController` | Hides only eligible decorative images while preserving controls, CAPTCHA, charts, maps, and informative graphics. |
107
+ | `HideVideosController` | Hides video elements and recognized YouTube/Vimeo embeds visually. |
108
+ | `BigCursorController` | Applies a larger high-contrast cursor where supported. |
109
+ | `ReadingMaskController` | Dims the page around a transparent reading window. |
110
+ | `ReadingGuideController` | Follows pointer/focus with a reading guide line. |
111
+ | `ResetController` | Resets display features and custom registered features without moving the widget. |
112
112
 
113
113
  Effects compose where appropriate. For example, contrast, saturation, invert,
114
114
  and grayscale are applied in a deterministic order. Defaults leave host styles
@@ -278,6 +278,7 @@ See [troubleshooting](docs/TROUBLESHOOTING.md) before filing an issue.
278
278
  - [API reference](docs/API.md)
279
279
  - [Feature behavior and bounds](docs/FEATURES.md)
280
280
  - [Link highlighting, focus visibility, and landmark skip links](docs/LINKS_AND_FOCUS.md)
281
+ - [Reduce motion and media controls](docs/REDUCE_MOTION.md)
281
282
  - [Contrast modes and forced-colors protection](docs/CONTRAST.md)
282
283
  - [Legible and dyslexia font stacks](docs/FONTS.md)
283
284
  - [Installation and Next.js](docs/INSTALLATION.md)
package/dist/index.d.mts CHANGED
@@ -400,6 +400,10 @@ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
400
400
 
401
401
  /** Detects whether the user's operating system has forced colors / high contrast active. */
402
402
  declare function isForcedColorsActive(): boolean;
403
+ declare function subscribeForcedColors(callback: () => void): () => void;
404
+ /** Detects whether the user's operating system has prefers-reduced-motion active. */
405
+ declare function isReducedMotionActive(): boolean;
406
+ declare function subscribeReducedMotion(callback: () => void): () => void;
403
407
  interface ContrastPalette {
404
408
  text: string;
405
409
  background: string;
@@ -433,6 +437,18 @@ interface ScriptSpacingConstraints {
433
437
  script: "cursive" | "indic" | "standard";
434
438
  }
435
439
  declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
440
+ /**
441
+ * Determines whether an element represents functional, informative, or protected visual content
442
+ * (e.g., interactive controls, CAPTCHA, charts, graphs, maps, QR codes, or images with meaningful alt/names).
443
+ * Such content must NEVER be hidden by decorative image preferences.
444
+ */
445
+ declare function isFunctionalOrMeaningfulImage(el: Element): boolean;
446
+ /**
447
+ * Determines whether an element represents an eligible decorative image that is safe to hide.
448
+ * An image is eligible if it is not functional or meaningful, and meets standard decorative cues
449
+ * (empty alt="", role="presentation", role="none", aria-hidden="true", or decorative class/attribute).
450
+ */
451
+ declare function isEligibleDecorativeImage(el: Element): boolean;
436
452
 
437
453
  interface LineHeightControllerProps {
438
454
  /**
@@ -487,7 +503,11 @@ declare function TextAlignController(): react.JSX.Element;
487
503
 
488
504
  declare function FontFamilyController(): react.JSX.Element;
489
505
 
490
- declare function HideImagesController(): react.JSX.Element;
506
+ interface HideImagesControllerProps {
507
+ label?: string;
508
+ }
509
+ declare function HideImagesController({ label, }?: HideImagesControllerProps): react.JSX.Element;
510
+ declare const HideDecorativeImagesController: typeof HideImagesController;
491
511
 
492
512
  declare function HideVideosController(): react.JSX.Element;
493
513
 
@@ -505,6 +525,13 @@ declare function ReadingGuideController(): react.JSX.Element;
505
525
  declare function HighlightFocusController(): react.JSX.Element;
506
526
  declare const FocusHighlightController: typeof HighlightFocusController;
507
527
 
528
+ /**
529
+ * Controller to reduce motion and pause active animations and media.
530
+ * Disables non-essential CSS animations, smooth scrolling, pauses running WAAPI animations,
531
+ * and pauses playing media while honoring operating system motion preferences.
532
+ */
533
+ declare function ReduceMotionController(): react.JSX.Element;
534
+
508
535
  declare function ResetController(): react.JSX.Element;
509
536
 
510
- export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, HighlightFocusController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SkipToMainLink, type SkipToMainLinkProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, findMainLandmark, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
537
+ export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SkipToMainLink, type SkipToMainLinkProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, findMainLandmark, getScriptSpacingConstraints, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, subscribeForcedColors, subscribeReducedMotion, useAccessibility };
package/dist/index.d.ts CHANGED
@@ -400,6 +400,10 @@ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
400
400
 
401
401
  /** Detects whether the user's operating system has forced colors / high contrast active. */
402
402
  declare function isForcedColorsActive(): boolean;
403
+ declare function subscribeForcedColors(callback: () => void): () => void;
404
+ /** Detects whether the user's operating system has prefers-reduced-motion active. */
405
+ declare function isReducedMotionActive(): boolean;
406
+ declare function subscribeReducedMotion(callback: () => void): () => void;
403
407
  interface ContrastPalette {
404
408
  text: string;
405
409
  background: string;
@@ -433,6 +437,18 @@ interface ScriptSpacingConstraints {
433
437
  script: "cursive" | "indic" | "standard";
434
438
  }
435
439
  declare function getScriptSpacingConstraints(element: HTMLElement): ScriptSpacingConstraints;
440
+ /**
441
+ * Determines whether an element represents functional, informative, or protected visual content
442
+ * (e.g., interactive controls, CAPTCHA, charts, graphs, maps, QR codes, or images with meaningful alt/names).
443
+ * Such content must NEVER be hidden by decorative image preferences.
444
+ */
445
+ declare function isFunctionalOrMeaningfulImage(el: Element): boolean;
446
+ /**
447
+ * Determines whether an element represents an eligible decorative image that is safe to hide.
448
+ * An image is eligible if it is not functional or meaningful, and meets standard decorative cues
449
+ * (empty alt="", role="presentation", role="none", aria-hidden="true", or decorative class/attribute).
450
+ */
451
+ declare function isEligibleDecorativeImage(el: Element): boolean;
436
452
 
437
453
  interface LineHeightControllerProps {
438
454
  /**
@@ -487,7 +503,11 @@ declare function TextAlignController(): react.JSX.Element;
487
503
 
488
504
  declare function FontFamilyController(): react.JSX.Element;
489
505
 
490
- declare function HideImagesController(): react.JSX.Element;
506
+ interface HideImagesControllerProps {
507
+ label?: string;
508
+ }
509
+ declare function HideImagesController({ label, }?: HideImagesControllerProps): react.JSX.Element;
510
+ declare const HideDecorativeImagesController: typeof HideImagesController;
491
511
 
492
512
  declare function HideVideosController(): react.JSX.Element;
493
513
 
@@ -505,6 +525,13 @@ declare function ReadingGuideController(): react.JSX.Element;
505
525
  declare function HighlightFocusController(): react.JSX.Element;
506
526
  declare const FocusHighlightController: typeof HighlightFocusController;
507
527
 
528
+ /**
529
+ * Controller to reduce motion and pause active animations and media.
530
+ * Disables non-essential CSS animations, smooth scrolling, pauses running WAAPI animations,
531
+ * and pauses playing media while honoring operating system motion preferences.
532
+ */
533
+ declare function ReduceMotionController(): react.JSX.Element;
534
+
508
535
  declare function ResetController(): react.JSX.Element;
509
536
 
510
- export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, HighlightFocusController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SkipToMainLink, type SkipToMainLinkProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, findMainLandmark, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
537
+ export { AccessibilityButton, type AccessibilityButtonProps, AccessibilityContext, type AccessibilityContextValue, AccessibilityList, type AccessibilityListProps, AccessibilityPlugin, type AccessibilityPluginProps, type AccessibilityPreferences, type AccessibilityState, BigCursorController, CONTRAST_MODES, CONTRAST_PALETTES, CONTRAST_PROTECTED_SELECTOR, ChoiceControl, type ChoiceControlProps, type ChoiceGroup, type ChoiceOption, ContrastController, type ContrastMode, ContrastModeController, type ContrastModeValue, type ContrastPalette, type CursorSizePreference, DEFAULT_PREFERENCES, DYSLEXIA_FONT_STACK, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FONT_FAMILY_PRESETS, FONT_FAMILY_PROTECTED_SELECTOR, FeatureCard, type FeatureCardProps, type FeatureOptions, type FeatureRegistration, type FeatureStatus, FocusHighlightController, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideDecorativeImagesController, HideImagesController, type HideImagesControllerProps, HideVideosController, HighlightFocusController, InvertColorsController, LEGIBLE_FONT_STACK, LINE_HEIGHT_RATIOS, LINE_HEIGHT_STEPS, LetterSpacingController, type LetterSpacingControllerProps, LineHeightController, type LineHeightControllerProps, LinkHighlightController, type LocaleStrings, PROFILE_DEFINITIONS, ParagraphSpacingController, type ParagraphSpacingControllerProps, type PluginPosition, type ProfileDefinition, type ProfilePresetId, ProfilePreviewCard, type ProfilePreviewCardProps, type ReaderMode, ReadingGuideController, ReadingMaskController, ReduceMotionController, ResetController, SaturationController, type SaturationPreference, type ScriptSpacingConstraints, SearchCount, type SearchCountProps, SkipToMainLink, type SkipToMainLinkProps, StepperControl, type StepperControlProps, type StorageMode, type SupportedLocale, TEXT_ALIGN_BLOCK_SELECTOR, TEXT_SCALE_PROTECTED_SELECTOR, TEXT_SCALE_STEPS, TEXT_SPACING_EXCLUDED_SELECTOR, TextAlignController, type TextAlignPreference, TextScaleController, type TextScaleControllerProps, type TextScaleStep, ToggleControl, type ToggleControlProps, type WidgetPlacement, WordSpacingController, type WordSpacingControllerProps, createInitialPreferencesState, enLocale, findMainLandmark, getScriptSpacingConstraints, isEligibleDecorativeImage, isForcedColorsActive, isFunctionalOrMeaningfulImage, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, subscribeForcedColors, subscribeReducedMotion, useAccessibility };