/** * @file Screen Reader Announcement Hook * @description Hook for announcing dynamic content changes to screen readers * * WCAG 2.1 Reference: Success Criterion 4.1.3 Status Messages (Level AA) * Uses ARIA live regions to announce content changes without moving focus. */ /** * Announcement priority levels * - polite: Waits for user to finish current task before announcing * - assertive: Interrupts current speech immediately (use sparingly) */ export type AnnouncementPriority = 'polite' | 'assertive'; /** * Options for announcements */ export interface AnnounceOptions { /** Priority level - 'polite' (default) or 'assertive' */ priority?: AnnouncementPriority; /** Clear the announcement after this many milliseconds */ clearAfter?: number; } /** * Hook for announcing dynamic content to screen readers * * @example * ```tsx * function SearchResults({ results }) { * const announce = useScreenReaderAnnounce(); * * useEffect(() => { * announce(`Found ${results.length} results`); * }, [results.length, announce]); * * return
...
; * } * ``` * * @example * ```tsx * // Assertive announcement for errors * function ErrorBanner({ error }) { * const announce = useScreenReaderAnnounce(); * * useEffect(() => { * if (error) { * announce(`Error: ${error.message}`, { priority: 'assertive' }); * } * }, [error, announce]); * } * ``` */ export declare function useScreenReaderAnnounce(): (message: string, options?: AnnounceOptions) => void; /** * Screen Reader Announcement Provider Component * * Add this to your app root if you prefer a component-based approach. * * @example * ```tsx * * ``` */ export declare function ScreenReaderAnnouncementRegion(): null; /** * Announce a message imperatively (not as a hook) * Useful for non-component code or callbacks * * @example * ```ts * // In an event handler * function handleSave() { * saveData().then(() => { * announceToScreenReader('Changes saved successfully'); * }); * } * ``` */ export declare function announceToScreenReader(message: string, options?: AnnounceOptions): void;