Skip to content

Commit e55415c

Browse files
committed
Remove native screen reader support
Use the "accesskit" feature flag to `eframe` instead. [AccessKit](https://github.com/AccessKit/accesskit) is the future. `tts` was a mess to compile on many platforms, so I no longer want the native `tts` dependency.
1 parent 8aa07e9 commit e55415c

File tree

9 files changed

+15
-74
lines changed

9 files changed

+15
-74
lines changed

crates/eframe/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ persistence = [
5555
## `eframe` will call `puffin::GlobalProfiler::lock().new_frame()` for you
5656
puffin = ["dep:puffin", "egui_glow?/puffin", "egui-wgpu?/puffin"]
5757

58-
## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`)
59-
screen_reader = ["egui-winit/screen_reader", "tts"]
58+
## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web.
59+
##
60+
## For other platforms, use the "accesskit" feature instead.
61+
web_screen_reader = ["tts"]
6062

6163
## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit.
6264
## This is used to generate images for the examples.

crates/egui-winit/Cargo.toml

-6
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ links = ["webbrowser"]
3737
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
3838
puffin = ["dep:puffin"]
3939

40-
## Experimental support for a screen reader.
41-
screen_reader = ["tts"]
42-
4340
## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
4441
serde = ["egui/serde", "dep:serde"]
4542

@@ -67,9 +64,6 @@ accesskit_winit = { version = "0.8.1", optional = true }
6764
puffin = { version = "0.14", optional = true }
6865
serde = { version = "1.0", optional = true, features = ["derive"] }
6966

70-
# feature screen_reader
71-
tts = { version = "0.24", optional = true }
72-
7367
webbrowser = { version = "0.8.3", optional = true }
7468

7569
[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]

crates/egui-winit/src/lib.rs

-8
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use egui::accesskit;
1919
pub use winit;
2020

2121
pub mod clipboard;
22-
pub mod screen_reader;
2322
mod window_settings;
2423

2524
pub use window_settings::WindowSettings;
@@ -75,7 +74,6 @@ pub struct State {
7574
current_pixels_per_point: f32,
7675

7776
clipboard: clipboard::Clipboard,
78-
screen_reader: screen_reader::ScreenReader,
7977

8078
/// If `true`, mouse inputs will be treated as touches.
8179
/// Useful for debugging touch support in egui.
@@ -115,7 +113,6 @@ impl State {
115113
current_pixels_per_point: 1.0,
116114

117115
clipboard: clipboard::Clipboard::new(wayland_display),
118-
screen_reader: screen_reader::ScreenReader::default(),
119116

120117
simulate_touch_screen: false,
121118
pointer_touch_id: None,
@@ -615,11 +612,6 @@ impl State {
615612
egui_ctx: &egui::Context,
616613
platform_output: egui::PlatformOutput,
617614
) {
618-
if egui_ctx.options(|o| o.screen_reader) {
619-
self.screen_reader
620-
.speak(&platform_output.events_description());
621-
}
622-
623615
let egui::PlatformOutput {
624616
cursor_icon,
625617
open_url,

crates/egui-winit/src/screen_reader.rs

-49
This file was deleted.

crates/egui/src/memory.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ pub struct Options {
103103
/// Controls the tessellator.
104104
pub tessellation_options: epaint::TessellationOptions,
105105

106-
/// This does not at all change the behavior of egui,
107-
/// but is a signal to any backend that we want the [`crate::PlatformOutput::events`] read out loud.
106+
/// This is a signal to any backend that we want the [`crate::PlatformOutput::events`] read out loud.
107+
///
108+
/// The only change to egui is that labels can be focused by pressing tab.
109+
///
108110
/// Screen readers is an experimental feature of egui, and not supported on all platforms.
111+
///
112+
/// `eframe` supports it only on web, using the `web_screen_reader` feature flag,
113+
/// but you should consider using [AccessKit](https://github.com/AccessKit/accesskit) instead,
114+
/// which `eframe` supports.
109115
pub screen_reader: bool,
110116

111117
/// If true, the most common glyphs (ASCII) are pre-rendered to the texture atlas.

crates/egui_demo_app/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ default = ["glow", "persistence"]
2020

2121
http = ["ehttp", "image", "poll-promise", "egui_extras/image"]
2222
persistence = ["eframe/persistence", "egui/persistence", "serde"]
23-
screen_reader = ["eframe/screen_reader"] # experimental
23+
web_screen_reader = ["eframe/web_screen_reader"] # experimental
2424
serde = ["dep:serde", "egui_demo_lib/serde", "egui/serde"]
2525
syntax_highlighting = ["egui_demo_lib/syntax_highlighting"]
2626

crates/egui_demo_app/src/backend_panel.rs

+2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ impl BackendPanel {
130130

131131
ui.separator();
132132

133+
#[cfg(target_arch = "wasm32")]
134+
#[cfg(feature = "web_screen-reader")]
133135
{
134136
let mut screen_reader = ui.ctx().options(|o| o.screen_reader);
135137
ui.checkbox(&mut screen_reader, "🔈 Screen reader").on_hover_text("Experimental feature: checking this will turn on the screen reader on supported platforms");

crates/egui_glium/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ clipboard = ["egui-winit/clipboard"]
3535
## Enable opening links in a browser when an egui hyperlink is clicked.
3636
links = ["egui-winit/links"]
3737

38-
## Experimental support for a screen reader.
39-
screen_reader = ["egui-winit/screen_reader"]
40-
4138

4239
[dependencies]
4340
egui = { version = "0.20.0", path = "../egui", default-features = false, features = [

crates/egui_glow/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ clipboard = ["egui-winit?/clipboard"]
3737
## enable opening links in a browser when an egui hyperlink is clicked.
3838
links = ["egui-winit?/links"]
3939

40-
## Experimental support for a screen reader.
41-
screen_reader = ["egui-winit?/screen_reader"]
42-
4340
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
4441
puffin = ["dep:puffin", "egui-winit?/puffin"]
4542

0 commit comments

Comments
 (0)