accessibility-plugin-react 2.7.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/README.md +4 -0
- package/dist/index.d.mts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +648 -354
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +539 -253
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +54 -0
- package/docs/API.md +3 -3
- package/docs/BUILD_AND_RELEASE_PLAN.md +2 -2
- package/docs/FEATURES.md +4 -0
- package/docs/LINKS_AND_FOCUS.md +65 -0
- package/docs/REDUCE_MOTION.md +64 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -277,6 +277,10 @@ See [troubleshooting](docs/TROUBLESHOOTING.md) before filing an issue.
|
|
|
277
277
|
|
|
278
278
|
- [API reference](docs/API.md)
|
|
279
279
|
- [Feature behavior and bounds](docs/FEATURES.md)
|
|
280
|
+
- [Link highlighting, focus visibility, and landmark skip links](docs/LINKS_AND_FOCUS.md)
|
|
281
|
+
- [Reduce motion and media controls](docs/REDUCE_MOTION.md)
|
|
282
|
+
- [Contrast modes and forced-colors protection](docs/CONTRAST.md)
|
|
283
|
+
- [Legible and dyslexia font stacks](docs/FONTS.md)
|
|
280
284
|
- [Installation and Next.js](docs/INSTALLATION.md)
|
|
281
285
|
- [Content Security Policy (CSP) guidance](docs/CSP.md)
|
|
282
286
|
- [Custom features](docs/CUSTOM_FEATURES.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -82,6 +82,7 @@ interface LocaleStrings {
|
|
|
82
82
|
description: string;
|
|
83
83
|
closeLabel: string;
|
|
84
84
|
skipToActions: string;
|
|
85
|
+
skipToMain?: string;
|
|
85
86
|
toolsLabel: string;
|
|
86
87
|
quickActionsLabel: string;
|
|
87
88
|
resetLabel: string;
|
|
@@ -326,6 +327,23 @@ declare function AccessibilityButton({ icon, draggable, title, description, clas
|
|
|
326
327
|
|
|
327
328
|
declare function AccessibilityList(props: AccessibilityListProps): react.JSX.Element;
|
|
328
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Searches the host document for an authentic main landmark:
|
|
332
|
+
* native `<main>` element or element with explicit `role="main"`.
|
|
333
|
+
* Returns null if no authentic main landmark exists.
|
|
334
|
+
*/
|
|
335
|
+
declare function findMainLandmark(): HTMLElement | null;
|
|
336
|
+
interface SkipToMainLinkProps {
|
|
337
|
+
className?: string;
|
|
338
|
+
label?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Accessible Skip to Main Content link.
|
|
342
|
+
* Only renders when a real `<main>` or `[role="main"]` landmark exists in the document,
|
|
343
|
+
* preventing broken or unreachable skip links in partial views or embedded layouts.
|
|
344
|
+
*/
|
|
345
|
+
declare function SkipToMainLink({ className, label }: SkipToMainLinkProps): react.JSX.Element | null;
|
|
346
|
+
|
|
329
347
|
declare function useAccessibility<T>(featureKey: string, defaultValue: T, options?: FeatureOptions<T>): {
|
|
330
348
|
value: T;
|
|
331
349
|
setValue: (next: T) => void;
|
|
@@ -382,6 +400,10 @@ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
|
|
|
382
400
|
|
|
383
401
|
/** Detects whether the user's operating system has forced colors / high contrast active. */
|
|
384
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;
|
|
385
407
|
interface ContrastPalette {
|
|
386
408
|
text: string;
|
|
387
409
|
background: string;
|
|
@@ -479,6 +501,21 @@ declare function ReadingMaskController(): react.JSX.Element;
|
|
|
479
501
|
|
|
480
502
|
declare function ReadingGuideController(): react.JSX.Element;
|
|
481
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Controller to toggle enhanced focus visibility.
|
|
506
|
+
* Provides high-contrast, multi-layer focus outlines for keyboard navigation,
|
|
507
|
+
* preserving disabled states and yielding to native operating system high contrast themes.
|
|
508
|
+
*/
|
|
509
|
+
declare function HighlightFocusController(): react.JSX.Element;
|
|
510
|
+
declare const FocusHighlightController: typeof HighlightFocusController;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Controller to reduce motion and pause active animations and media.
|
|
514
|
+
* Disables non-essential CSS animations, smooth scrolling, pauses running WAAPI animations,
|
|
515
|
+
* and pauses playing media while honoring operating system motion preferences.
|
|
516
|
+
*/
|
|
517
|
+
declare function ReduceMotionController(): react.JSX.Element;
|
|
518
|
+
|
|
482
519
|
declare function ResetController(): react.JSX.Element;
|
|
483
520
|
|
|
484
|
-
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, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, 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, 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, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
|
|
521
|
+
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, 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, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, subscribeForcedColors, subscribeReducedMotion, useAccessibility };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ interface LocaleStrings {
|
|
|
82
82
|
description: string;
|
|
83
83
|
closeLabel: string;
|
|
84
84
|
skipToActions: string;
|
|
85
|
+
skipToMain?: string;
|
|
85
86
|
toolsLabel: string;
|
|
86
87
|
quickActionsLabel: string;
|
|
87
88
|
resetLabel: string;
|
|
@@ -326,6 +327,23 @@ declare function AccessibilityButton({ icon, draggable, title, description, clas
|
|
|
326
327
|
|
|
327
328
|
declare function AccessibilityList(props: AccessibilityListProps): react.JSX.Element;
|
|
328
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Searches the host document for an authentic main landmark:
|
|
332
|
+
* native `<main>` element or element with explicit `role="main"`.
|
|
333
|
+
* Returns null if no authentic main landmark exists.
|
|
334
|
+
*/
|
|
335
|
+
declare function findMainLandmark(): HTMLElement | null;
|
|
336
|
+
interface SkipToMainLinkProps {
|
|
337
|
+
className?: string;
|
|
338
|
+
label?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Accessible Skip to Main Content link.
|
|
342
|
+
* Only renders when a real `<main>` or `[role="main"]` landmark exists in the document,
|
|
343
|
+
* preventing broken or unreachable skip links in partial views or embedded layouts.
|
|
344
|
+
*/
|
|
345
|
+
declare function SkipToMainLink({ className, label }: SkipToMainLinkProps): react.JSX.Element | null;
|
|
346
|
+
|
|
329
347
|
declare function useAccessibility<T>(featureKey: string, defaultValue: T, options?: FeatureOptions<T>): {
|
|
330
348
|
value: T;
|
|
331
349
|
setValue: (next: T) => void;
|
|
@@ -382,6 +400,10 @@ type ContrastModeValue = (typeof CONTRAST_MODES)[number];
|
|
|
382
400
|
|
|
383
401
|
/** Detects whether the user's operating system has forced colors / high contrast active. */
|
|
384
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;
|
|
385
407
|
interface ContrastPalette {
|
|
386
408
|
text: string;
|
|
387
409
|
background: string;
|
|
@@ -479,6 +501,21 @@ declare function ReadingMaskController(): react.JSX.Element;
|
|
|
479
501
|
|
|
480
502
|
declare function ReadingGuideController(): react.JSX.Element;
|
|
481
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Controller to toggle enhanced focus visibility.
|
|
506
|
+
* Provides high-contrast, multi-layer focus outlines for keyboard navigation,
|
|
507
|
+
* preserving disabled states and yielding to native operating system high contrast themes.
|
|
508
|
+
*/
|
|
509
|
+
declare function HighlightFocusController(): react.JSX.Element;
|
|
510
|
+
declare const FocusHighlightController: typeof HighlightFocusController;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Controller to reduce motion and pause active animations and media.
|
|
514
|
+
* Disables non-essential CSS animations, smooth scrolling, pauses running WAAPI animations,
|
|
515
|
+
* and pauses playing media while honoring operating system motion preferences.
|
|
516
|
+
*/
|
|
517
|
+
declare function ReduceMotionController(): react.JSX.Element;
|
|
518
|
+
|
|
482
519
|
declare function ResetController(): react.JSX.Element;
|
|
483
520
|
|
|
484
|
-
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, FontFamilyController, type FontFamilyPreference, type FontFamilyPreset, FontSizeController, type FontSizeControllerProps, GrayscaleController, HideImagesController, HideVideosController, 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, 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, getScriptSpacingConstraints, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, useAccessibility };
|
|
521
|
+
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, 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, isForcedColorsActive, isProtectedFromContrast, isProtectedFromFontFamily, isProtectedFromTextAlign, isProtectedFromTextScale, isProtectedFromTextSpacing, isReducedMotionActive, isRtlLocale, normalizePreferenceValue, normalizePreferences, preferencesReducer, registerLocale, resolveEffectivePreferences, resolveLocaleStrings, subscribeForcedColors, subscribeReducedMotion, useAccessibility };
|