Skip to content

Commit

Permalink
Rename accesskit feature flag to accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Jun 26, 2024
1 parent 7f7e91b commit 4392aab
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/dioxus-blitz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ version = "0.0.0"
edition = "2021"

[features]
accesskit = ["dep:accesskit", "dep:accesskit_winit"]
accessibility = ["dep:accesskit", "dep:accesskit_winit"]
hot-reload = []
default = ["accesskit"]
default = ["accessibility"]

[dependencies]
accesskit = { version = "0.15.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/dioxus-blitz/src/accessibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl AccessibilityState {
self.adapter.update_if_active(|| tree_update)
}

#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
fn build_node(&mut self, node: &Node) -> (accesskit::NodeId, accesskit::NodeBuilder) {
let mut node_builder = accesskit::NodeBuilder::default();
if let Some(element_data) = node.element_data() {
Expand Down
4 changes: 2 additions & 2 deletions packages/dioxus-blitz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod documents;
mod waker;
mod window;

#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
mod accessibility;

use crate::waker::{EventData, UserEvent};
Expand Down Expand Up @@ -191,7 +191,7 @@ fn launch_with_window<Doc: DocumentLike + 'static>(window: View<'static, Doc>) {
}
};
}
#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
UserEvent::Accessibility(accessibility_event) => {
if let Some(window) = windows.get_mut(&accessibility_event.window_id) {
window.handle_accessibility_event(&accessibility_event.window_event);
Expand Down
6 changes: 3 additions & 3 deletions packages/dioxus-blitz/src/waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use futures_util::task::ArcWake;
use std::sync::Arc;
use winit::{event_loop::EventLoopProxy, window::WindowId};

#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
use accesskit_winit::Event as AccessibilityEvent;

#[derive(Debug, Clone)]
Expand All @@ -13,7 +13,7 @@ pub enum UserEvent {
},

/// An accessibility event from `accesskit`.
#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
Accessibility(Arc<AccessibilityEvent>),

/// A hotreload event, basically telling us to update our templates.
Expand All @@ -26,7 +26,7 @@ pub enum UserEvent {
HotReloadEvent(dioxus_hot_reload::HotReloadMsg),
}

#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
impl From<AccessibilityEvent> for UserEvent {
fn from(value: AccessibilityEvent) -> Self {
Self::Accessibility(Arc::new(value))
Expand Down
8 changes: 4 additions & 4 deletions packages/dioxus-blitz/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use winit::event_loop::{ActiveEventLoop, EventLoopProxy};
use winit::{event::WindowEvent, keyboard::KeyCode, keyboard::ModifiersState, window::Window};

struct State {
#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
/// Accessibility adapter for `accesskit`.
accessibility: crate::accessibility::AccessibilityState,

Expand Down Expand Up @@ -56,7 +56,7 @@ impl<'a, Doc: DocumentLike> View<'a, Doc> {
Some(waker) => {
let cx = std::task::Context::from_waker(waker);
if self.renderer.poll(cx) {
#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
{
if let Some(ref mut state) = self.state {
// TODO send fine grained accessibility tree updates.
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<'a, Doc: DocumentLike> View<'a, Doc> {
}
}

#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
pub fn handle_accessibility_event(&mut self, event: &accesskit_winit::WindowEvent) {
match event {
accesskit_winit::WindowEvent::InitialTreeRequested => {
Expand Down Expand Up @@ -330,7 +330,7 @@ impl<'a, Doc: DocumentLike> View<'a, Doc> {
&window,
);
self.state = Some(State {
#[cfg(feature = "accesskit")]
#[cfg(feature = "accessibility")]
accessibility: crate::accessibility::AccessibilityState::new(
&window,
proxy.clone(),
Expand Down

0 comments on commit 4392aab

Please sign in to comment.