Raxol.Core.Accessibility.Announcements (Raxol v0.5.0)

View Source

Handles screen reader announcements and announcement queue management.

Summary

Functions

Make an announcement for screen readers.

Clear all pending announcements.

Get the next announcement to be read by screen readers for a specific user/context.

Functions

announce(message, opts \\ [], user_preferences_pid_or_name)

Make an announcement for screen readers.

Parameters

  • message - The message to announce
  • opts - Options for the announcement
  • user_preferences_pid_or_name - The PID or registered name of the UserPreferences process to use (optional).

Options

  • :priority - Priority level (:low, :medium, :high) (default: :medium)
  • :interrupt - Whether to interrupt current announcements (default: false)

Examples

iex> Announcements.announce("Button clicked")
:ok

iex> Announcements.announce("Error occurred", priority: :high, interrupt: true)
:ok

clear_announcements()

Clear all pending announcements.

Examples

iex> Announcements.clear_announcements()
:ok

get_next_announcement(user_preferences_pid_or_name)

Get the next announcement to be read by screen readers for a specific user/context.

Parameters

  • user_preferences_pid_or_name - The PID or registered name of the UserPreferences process to use (optional).

Examples

iex> Announcements.get_next_announcement(:user1)
"Button clicked"