Raxol.Core.Accessibility.Announcements (Raxol v2.0.1)

View Source

Handles screen reader announcements and announcement queue management.

Summary

Functions

Make an announcement for screen readers.

Returns a specification to start this module under a supervisor.

Clear all pending announcements.

Clear all pending announcements for a specific user.

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

Functions

add_subscription(ref, pid)

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

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear_announcements()

Clear all pending announcements.

Examples

iex> Announcements.clear_announcements()
:ok

clear_announcements(user_preferences_pid_or_name)

Clear all pending announcements for a specific user.

Examples

iex> Announcements.clear_announcements(:user_prefs)
: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"

get_subscriptions()

remove_subscription(ref)

start_link(opts)