Skip to content

Commit

Permalink
fix: a11y nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 authored and jackpot51 committed Nov 11, 2024
1 parent 3297263 commit deb719e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
7 changes: 1 addition & 6 deletions widget/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,8 @@ where
cursor: mouse::Cursor,
) -> iced_accessibility::A11yTree {
let c_layout = layout.children().next().unwrap();
let c_state = state.children.get(0);

self.content.as_widget().a11y_nodes(
c_layout,
c_state.unwrap_or(&Tree::empty()),
cursor,
)
self.content.as_widget().a11y_nodes(c_layout, state, cursor)
}

fn drag_destinations(
Expand Down
18 changes: 6 additions & 12 deletions widget/src/lazy/responsive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,12 @@ where
tree: &Tree,
cursor_position: mouse::Cursor,
) -> iced_accessibility::A11yTree {
use std::rc::Rc;

let tree = tree.state.downcast_ref::<Rc<RefCell<Option<Tree>>>>();
if let Some(tree) = tree.borrow().as_ref() {
self.content.borrow().element.as_widget().a11y_nodes(
layout,
&tree.children[0],
cursor_position,
)
} else {
iced_accessibility::A11yTree::default()
}
let state = tree.state.downcast_ref::<State>().tree.borrow();
self.content.borrow().element.as_widget().a11y_nodes(
layout,
&*state,
cursor_position,
)
}

fn id(&self) -> Option<core::widget::Id> {
Expand Down
16 changes: 16 additions & 0 deletions widget/src/mouse_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,22 @@ where
);
}
}

fn a11y_nodes(

Check failure on line 359 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / widget

method `a11y_nodes` is not a member of trait `Widget`

Check failure on line 359 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / wasm

method `a11y_nodes` is not a member of trait `Widget`

Check failure on line 359 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / web

method `a11y_nodes` is not a member of trait `Widget`
&self,
layout: Layout<'_>,
state: &Tree,
cursor: mouse::Cursor,
) -> iced_accessibility::A11yTree {

Check failure on line 364 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / widget

failed to resolve: use of undeclared crate or module `iced_accessibility`

Check failure on line 364 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / wasm

failed to resolve: use of undeclared crate or module `iced_accessibility`
let c_state = state.children.get(0);

let ret = self.content.as_widget().a11y_nodes(

Check failure on line 367 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / widget

no method named `a11y_nodes` found for reference `&dyn iced_renderer::iced_core::Widget<Message, Theme, Renderer>` in the current scope

Check failure on line 367 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / wasm

no method named `a11y_nodes` found for reference `&dyn iced_renderer::iced_core::Widget<Message, Theme, Renderer>` in the current scope

Check failure on line 367 in widget/src/mouse_area.rs

View workflow job for this annotation

GitHub Actions / web

no method named `a11y_nodes` found for reference `&dyn iced_renderer::iced_core::Widget<Message, Theme, Renderer>` in the current scope
layout,
c_state.unwrap_or(&Tree::empty()),
cursor,
);
return ret;
}
}

impl<'a, Message, Theme, Renderer> From<MouseArea<'a, Message, Theme, Renderer>>
Expand Down

0 comments on commit deb719e

Please sign in to comment.