Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement accessibility APIs via AccessKit #2294

Merged
merged 32 commits into from
Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6483b45
squash before rebase
mwcampbell Nov 29, 2022
6dd2118
Update AccessKit, introducing support for editable spinners on Window…
mwcampbell Nov 29, 2022
de62604
Restore support for increment and decrement actions in DragValue
mwcampbell Nov 29, 2022
a08282f
Avoid VoiceOver race condition bug
mwcampbell Nov 29, 2022
a472d14
fix clippy lint
mwcampbell Nov 29, 2022
9e10822
Tell AccessKit that the default action for a text edit (equivalent to…
mwcampbell Nov 29, 2022
b65fd40
Refactor InputState functions for AccessKit actions
mwcampbell Nov 29, 2022
599d147
Support the AccessKit SetValue for DragValue; this is the only way fo…
mwcampbell Nov 29, 2022
a31d7dc
Same for Slider
mwcampbell Nov 29, 2022
9473dbd
Properly associate the slider label with both the slider and the drag…
mwcampbell Nov 29, 2022
2114978
Lazily activate egui's AccessKit support
mwcampbell Nov 29, 2022
c47c3a1
fix clippy lint
mwcampbell Nov 29, 2022
884001f
Update AccessKit
mwcampbell Nov 30, 2022
4282133
More documentation, particularly around lazy activation
mwcampbell Nov 30, 2022
c066889
Tweak one of the doc comments
mwcampbell Nov 30, 2022
d14eab6
See if I can get AccessKit exempted from the 'missing backticks' lint
mwcampbell Nov 30, 2022
3109ee9
Make PlatformOutput::accesskit_update an Option
mwcampbell Nov 30, 2022
18ccf1f
Refactor lazy activation
mwcampbell Nov 30, 2022
49bbcf9
Refactor node mutation (again)
mwcampbell Nov 30, 2022
7763ee0
Eliminate the need for an explicit is_accesskit_active method, at lea…
mwcampbell Nov 30, 2022
345b3c7
Fix doc comment
mwcampbell Nov 30, 2022
4a273c7
More refactoring of tree construction; don't depend on Arc::get_mut
mwcampbell Nov 30, 2022
ae3a982
Override a clippy lint; I seem to have no other choice
mwcampbell Nov 30, 2022
87d3a90
Final planned refactor: a more flexible approach to hierarchy
mwcampbell Nov 30, 2022
f1908e2
Last AccessKit update for this PR; includes an important macOS DPI fix
mwcampbell Dec 4, 2022
9b71817
Move and document the optional accesskit dependency
mwcampbell Dec 4, 2022
88840ef
Fix comment typo
Dec 4, 2022
0a6afeb
reformat
mwcampbell Dec 4, 2022
6d222c6
More elegant code for conditionally creating a node
Dec 4, 2022
46e360b
Set step to 1.0 for all integer sliders
mwcampbell Dec 4, 2022
3077177
Add doc example for Response::labelled_by
mwcampbell Dec 4, 2022
e522a9b
Clarify a TODO comment I left for myself
mwcampbell Dec 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* Added `Area::constrain` and `Window::constrain` which constrains area to the screen bounds. ([#2270](https://github.com/emilk/egui/pull/2270)).
* Added `Area::pivot` and `Window::pivot` which controls what part of the window to position. ([#2303](https://github.com/emilk/egui/pull/2303)).
* Added support for [thin space](https://en.wikipedia.org/wiki/Thin_space).
* Added optional integration with [AccessKit](https://accesskit.dev/) for implementing platform accessibility APIs. ([#2294](https://github.com/emilk/egui/pull/2294)).

### Changed 🔧
* Panels always have a separator line, but no stroke on other sides. Their spacing has also changed slightly ([#2261](https://github.com/emilk/egui/pull/2261)).
Expand Down
196 changes: 190 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doc-valid-idents = ["AccessKit", ".."]
1 change: 1 addition & 0 deletions crates/eframe/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NOTE: [`egui-winit`](../egui-winit/CHANGELOG.md), [`egui_glium`](../egui_glium/C
* Web: Add `WebInfo::user_agent` ([#2202](https://github.com/emilk/egui/pull/2202)).
* Wgpu device/adapter/surface creation has now various configuration options exposed via `NativeOptions/WebOptions::wgpu_options` ([#2207](https://github.com/emilk/egui/pull/2207)).
* Fix: Make sure that `native_pixels_per_point` is updated ([#2256](https://github.com/emilk/egui/pull/2256)).
* Added optional, but enabled by default, integration with [AccessKit](https://accesskit.dev/) for implementing platform accessibility APIs. ([#2294](https://github.com/emilk/egui/pull/2294)).


## 0.19.0 - 2022-08-20
Expand Down
5 changes: 4 additions & 1 deletion crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ all-features = true


[features]
default = ["default_fonts", "glow"]
default = ["accesskit", "default_fonts", "glow"]

## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
accesskit = ["egui/accesskit", "egui-winit/accesskit"]

## Detect dark mode system preference using [`dark-light`](https://docs.rs/dark-light).
##
Expand Down
28 changes: 28 additions & 0 deletions crates/eframe/src/native/epi_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ use winit::event_loop::EventLoopWindowTarget;
#[cfg(target_os = "macos")]
use winit::platform::macos::WindowBuilderExtMacOS as _;

#[cfg(feature = "accesskit")]
use egui::accesskit;
#[cfg(feature = "accesskit")]
use egui_winit::accesskit_winit;
use egui_winit::{native_pixels_per_point, EventResponse, WindowSettings};

use crate::{epi, Theme, WindowInfo};
Expand Down Expand Up @@ -262,6 +266,25 @@ impl EpiIntegration {
}
}

#[cfg(feature = "accesskit")]
pub fn init_accesskit<E: From<accesskit_winit::ActionRequestEvent> + Send>(
&mut self,
window: &winit::window::Window,
event_loop_proxy: winit::event_loop::EventLoopProxy<E>,
) {
let egui_ctx = self.egui_ctx.clone();
self.egui_winit
.init_accesskit(window, event_loop_proxy, move || {
// This function is called when an accessibility client
// (e.g. screen reader) makes its first request. If we got here,
// we know that an accessibility tree is actually wanted.
egui_ctx.enable_accesskit();
// Enqueue a repaint so we'll receive a full tree update soon.
egui_ctx.request_repaint();
egui::accesskit_placeholder_tree_update()
});
}

pub fn warm_up(&mut self, app: &mut dyn epi::App, window: &winit::window::Window) {
crate::profile_function!();
let saved_memory: egui::Memory = self.egui_ctx.memory().clone();
Expand Down Expand Up @@ -301,6 +324,11 @@ impl EpiIntegration {
self.egui_winit.on_event(&self.egui_ctx, event)
}

#[cfg(feature = "accesskit")]
pub fn on_accesskit_action_request(&mut self, request: accesskit::ActionRequest) {
self.egui_winit.on_accesskit_action_request(request);
}

pub fn update(
&mut self,
app: &mut dyn epi::App,
Expand Down
Loading