Raxol.UI.Accessibility.ScreenReader (Raxol v2.0.1)
View SourceComprehensive screen reader support system for Raxol terminal applications.
This module provides full accessibility compliance including:
- NVDA, JAWS, VoiceOver, and Orca screen reader support
- ARIA attributes and semantic markup generation
- Live region management for dynamic content updates
- Keyboard navigation and focus management
- Accessible names and descriptions
- Screen reader optimization for terminal interfaces
- Speech synthesis integration for audio feedback
- Braille display support through platform APIs
- Multi-language accessibility support
Features
Screen Reader Integration
- Automatic ARIA markup generation for UI components
- Live region announcements for status changes
- Landmark navigation (main, navigation, complementary)
- Skip links for keyboard navigation efficiency
- Accessible form labeling and validation feedback
Terminal-Specific Accessibility
- Virtual cursor navigation for terminal content
- Character-by-character reading mode
- Color and formatting description for visual elements
- Command completion and syntax assistance
- Error message verbalization with context
Usage
# Initialize screen reader support
{:ok, sr} = ScreenReader.start_link(
screen_reader: :auto_detect, # or :nvda, :jaws, :voiceover, :orca
language: "en-US",
speech_rate: 200,
enable_braille: true
)
# Register UI component for accessibility
ScreenReader.register_component(sr, "main-terminal", %{
role: "application",
label: "Terminal Application",
description: "Interactive terminal interface",
landmarks: ["main", "navigation"]
})
# Announce dynamic content changes
ScreenReader.announce(sr, "Command completed successfully", :polite)
ScreenReader.announce(sr, "Error: File not found", :assertive)
# Set focus and update accessible state
ScreenReader.set_focus(sr, "command-input")
ScreenReader.update_property(sr, "status-bar", %{
live: "polite",
text: "Ready - 15:32"
})
Summary
Functions
Announces text to screen readers with specified priority.
Provides keyboard shortcut information for screen readers.
Returns a specification to start this module under a supervisor.
Enables or disables specific accessibility features.
Creates ARIA live region markup for HTML output.
Generates skip link navigation for keyboard users.
Describes visual formatting to screen reader users.
Gets the current accessibility state of a component.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Reads content at cursor position with specified verbosity.
Registers a UI component for screen reader accessibility.
Updates the focus to a specific component.
Sets reading mode for terminal content (character/word/line).
Updates an accessibility property of a component.
Validates WCAG 2.1 compliance for a component configuration.
Types
@type announcement_priority() :: :off | :polite | :assertive
@type aria_role() ::
:application
| :document
| :dialog
| :navigation
| :main
| :complementary
| :banner
| :contentinfo
| :button
| :textbox
| :listbox
| :list
| :listitem
| :table
| :row
| :cell
| :columnheader
| :rowheader
@type config() :: %{ screen_reader: screen_reader_type(), language: String.t(), speech_rate: integer(), speech_pitch: integer(), speech_volume: float(), enable_braille: boolean(), enable_audio_cues: boolean(), verbosity_level: :minimal | :normal | :verbose, keyboard_echo: boolean(), character_echo: boolean(), word_echo: boolean() }
@type focus_target() :: String.t()
@type screen_reader_type() :: :nvda | :jaws | :voiceover | :orca | :auto_detect
Functions
Announces text to screen readers with specified priority.
Provides keyboard shortcut information for screen readers.
Returns a specification to start this module under a supervisor.
See Supervisor.
Enables or disables specific accessibility features.
Creates ARIA live region markup for HTML output.
Generates skip link navigation for keyboard users.
Describes visual formatting to screen reader users.
Gets the current accessibility state of a component.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Reads content at cursor position with specified verbosity.
Registers a UI component for screen reader accessibility.
Updates the focus to a specific component.
Sets reading mode for terminal content (character/word/line).
Updates an accessibility property of a component.
Validates WCAG 2.1 compliance for a component configuration.