Skip to main content

ravenrs_app_a11y/
lib.rs

1//! The accessibility of a RavenRS business application, so that every application made with
2//! `ravenrs-app` reaches screen readers and the keyboard with nothing written for them.
3//!
4//! * [`AccessibleText`] says what a field or an action is called and what is said after it, from
5//!   the model: the caption, unless the declaration or the model says otherwise.
6//! * [`Announcer`] says what changed, such as a record kept or deleted, through a [`LiveRegion`].
7//! * [`AccessWords`] are the words of those announcements, by key, in each language.
8//! * [`Audit`] walks an application with no window and says what keeps someone out: a control
9//!   with no name, focus that is held, contrast too low on its themes, two commands on the same
10//!   keys. A test of any example calls it.
11//!
12//! ```
13//! use ravenrs_app_a11y::{AccessibleText, Audit};
14//! use ravenrs_app::{FieldInfo, FieldKind};
15//!
16//! let until = FieldInfo::new("until", FieldKind::Date).caption("Até").accessible_name("Fim do período");
17//! assert_eq!(AccessibleText::of_field(&until, None, "Até").name, "Fim do período");
18//!
19//! let mut ui = ravenrs_widgets::Ui::new(ravenrs_widgets::Button::new("Salvar"), ravenrs_style::Theme::raven_light());
20//! Audit::new().screen(&mut ui, "início").assert_clean();
21//! ```
22
23mod announce;
24mod audit;
25mod names;
26pub mod words;
27
28pub use announce::{Announcement, Announcer, LiveRegion, Urgency};
29pub use audit::{
30    Audit, Finding, Problem, Report, TEXT_CONTRAST, UI_CONTRAST, check_focus, check_shortcuts, check_theme,
31    check_tree, is_control,
32};
33pub use names::AccessibleText;
34pub use words::AccessWords;