Skip to content

Commit

Permalink
Remove native screen reader support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emilk committed Feb 4, 2023
1 parent 8aa07e9 commit e55415c
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 74 deletions.
6 changes: 4 additions & 2 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ persistence = [
## `eframe` will call `puffin::GlobalProfiler::lock().new_frame()` for you
puffin = ["dep:puffin", "egui_glow?/puffin", "egui-wgpu?/puffin"]

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

## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit.
## This is used to generate images for the examples.
Expand Down
6 changes: 0 additions & 6 deletions crates/egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ links = ["webbrowser"]
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin"]

## Experimental support for a screen reader.
screen_reader = ["tts"]

## Allow serialization of [`WindowSettings`] using [`serde`](https://docs.rs/serde).
serde = ["egui/serde", "dep:serde"]

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

# feature screen_reader
tts = { version = "0.24", optional = true }

webbrowser = { version = "0.8.3", optional = true }

[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
Expand Down
8 changes: 0 additions & 8 deletions crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use egui::accesskit;
pub use winit;

pub mod clipboard;
pub mod screen_reader;
mod window_settings;

pub use window_settings::WindowSettings;
Expand Down Expand Up @@ -75,7 +74,6 @@ pub struct State {
current_pixels_per_point: f32,

clipboard: clipboard::Clipboard,
screen_reader: screen_reader::ScreenReader,

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

clipboard: clipboard::Clipboard::new(wayland_display),
screen_reader: screen_reader::ScreenReader::default(),

simulate_touch_screen: false,
pointer_touch_id: None,
Expand Down Expand Up @@ -615,11 +612,6 @@ impl State {
egui_ctx: &egui::Context,
platform_output: egui::PlatformOutput,
) {
if egui_ctx.options(|o| o.screen_reader) {
self.screen_reader
.speak(&platform_output.events_description());
}

let egui::PlatformOutput {
cursor_icon,
open_url,
Expand Down
49 changes: 0 additions & 49 deletions crates/egui-winit/src/screen_reader.rs

This file was deleted.

10 changes: 8 additions & 2 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ pub struct Options {
/// Controls the tessellator.
pub tessellation_options: epaint::TessellationOptions,

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

/// If true, the most common glyphs (ASCII) are pre-rendered to the texture atlas.
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default = ["glow", "persistence"]

http = ["ehttp", "image", "poll-promise", "egui_extras/image"]
persistence = ["eframe/persistence", "egui/persistence", "serde"]
screen_reader = ["eframe/screen_reader"] # experimental
web_screen_reader = ["eframe/web_screen_reader"] # experimental
serde = ["dep:serde", "egui_demo_lib/serde", "egui/serde"]
syntax_highlighting = ["egui_demo_lib/syntax_highlighting"]

Expand Down
2 changes: 2 additions & 0 deletions crates/egui_demo_app/src/backend_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ impl BackendPanel {

ui.separator();

#[cfg(target_arch = "wasm32")]
#[cfg(feature = "web_screen-reader")]
{
let mut screen_reader = ui.ctx().options(|o| o.screen_reader);
ui.checkbox(&mut screen_reader, "🔈 Screen reader").on_hover_text("Experimental feature: checking this will turn on the screen reader on supported platforms");
Expand Down
3 changes: 0 additions & 3 deletions crates/egui_glium/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ clipboard = ["egui-winit/clipboard"]
## Enable opening links in a browser when an egui hyperlink is clicked.
links = ["egui-winit/links"]

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


[dependencies]
egui = { version = "0.20.0", path = "../egui", default-features = false, features = [
Expand Down
3 changes: 0 additions & 3 deletions crates/egui_glow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ clipboard = ["egui-winit?/clipboard"]
## enable opening links in a browser when an egui hyperlink is clicked.
links = ["egui-winit?/links"]

## Experimental support for a screen reader.
screen_reader = ["egui-winit?/screen_reader"]

## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
puffin = ["dep:puffin", "egui-winit?/puffin"]

Expand Down

0 comments on commit e55415c

Please sign in to comment.