Skip to content

Commit d502b34

Browse files
committed
chore: Resolve conflicts
2 parents 681ce93 + 0cb934f commit d502b34

40 files changed

+1404
-211
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ skia-safe = { workspace = true }
7979
tokio = { workspace = true, features = ["fs"]}
8080
dioxus = { workspace = true }
8181
freya = { workspace = true }
82+
freya-hooks = { workspace = true }
8283
freya-core = { workspace = true }
8384
freya-testing = { workspace = true }
8485
reqwest = { version = "0.12.0", features = ["json"] }
@@ -96,6 +97,7 @@ tree-sitter-rust = "0.23.0"
9697
rfd = "0.14.1"
9798
bytes = "1.5.0"
9899
dioxus-sdk = { workspace = true }
100+
winit = { workspace = true }
99101

100102
[profile.release]
101103
lto = true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
fn app() -> Element {
2626
let mut count = use_signal(|| 0);
2727

28-
render!(
28+
rsx!(
2929
rect {
3030
height: "50%",
3131
width: "100%",
@@ -70,7 +70,7 @@ fn app() -> Element {
7070

7171
Thanks to my sponsors for supporting this project! 😄
7272

73-
<!-- sponsors --><a href="https://github.com/piny4man"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;8446285?u&#x3D;fd37db4dd9b4ba94dabe0bccc3a95ef2a35376ab&amp;v&#x3D;4" width="60px" alt="" /></a><!-- sponsors -->
73+
<!-- sponsors --><a href="https://github.com/piny4man"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;8446285?u&#x3D;fd37db4dd9b4ba94dabe0bccc3a95ef2a35376ab&amp;v&#x3D;4" width="60px" alt="" /></a><a href="https://github.com/gqf2008"><img src="https:&#x2F;&#x2F;avatars.githubusercontent.com&#x2F;u&#x2F;2295878?v&#x3D;4" width="60px" alt="高庆丰" /></a><!-- sponsors -->
7474

7575
### Want to try it? 🤔
7676

crates/components/src/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn Input(
217217
main_align: "center",
218218
cursor_reference,
219219
a11y_id,
220-
a11y_role: "textInput",
220+
a11y_role: "text-input",
221221
a11y_auto_focus: "{auto_focus}",
222222
onkeydown,
223223
onkeyup,

crates/components/src/network_image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pub fn NetworkImage(props: NetworkImageProps) -> Element {
124124
a11y_id,
125125
image_data,
126126
a11y_role: "image",
127-
a11y_alt: alt
127+
a11y_name: alt
128128
})
129129
} else if *status.read() == ImageState::Loading {
130130
if let Some(loading_element) = &props.loading {

crates/components/src/scroll_views/scroll_bar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn ScrollBar(
5656
rsx!(
5757
rect {
5858
overflow: "clip",
59-
a11y_role:"scrollBar",
59+
a11y_role: "scroll-bar",
6060
width: "{width}",
6161
height: "{height}",
6262
offset_x: "{offset_x}",

crates/components/src/scroll_views/scroll_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ pub fn ScrollView(
372372

373373
rsx!(
374374
rect {
375-
a11y_role:"scrollView",
375+
a11y_role:"scroll-view",
376376
overflow: "clip",
377377
direction: "horizontal",
378378
width,

crates/components/src/scroll_views/use_scroll_controller.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ impl ScrollController {
7575
}
7676
}
7777

78+
pub fn x(&self) -> Signal<i32> {
79+
self.x
80+
}
81+
82+
pub fn y(&self) -> Signal<i32> {
83+
self.y
84+
}
85+
7886
pub fn use_apply(&mut self, width: f32, height: f32) {
7987
let scope_id = current_scope_id().unwrap();
8088

crates/components/src/scroll_views/virtual_scroll_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ pub fn VirtualScrollView<
447447

448448
rsx!(
449449
rect {
450-
a11y_role:"scrollView",
450+
a11y_role: "scroll-view",
451451
overflow: "clip",
452452
direction: "horizontal",
453453
width: "{width}",

crates/core/src/accessibility/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use freya_native_core::{
44
real_dom::NodeImmutable,
55
};
66
use freya_node_state::AccessibilityNodeState;
7+
use itertools::Itertools;
78
pub use tree::*;
89

910
use crate::{
@@ -54,7 +55,9 @@ impl NodeAccessibility for DioxusNode<'_> {
5455

5556
/// Collect all descendant accessibility node ids
5657
fn get_accessibility_children(&self) -> Vec<AccessibilityId> {
57-
let node_accessibility = &*self.get::<AccessibilityNodeState>().unwrap();
58-
node_accessibility.descencent_accessibility_ids.clone()
58+
self.children()
59+
.into_iter()
60+
.filter_map(|child| child.get_accessibility_id())
61+
.collect_vec()
5962
}
6063
}

crates/core/src/accessibility/tree.rs

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,20 @@ impl AccessibilityTree {
152152
// Mark the ancestors as modified
153153
for node_id in added_or_updated_ids.clone() {
154154
let node_ref = rdom.get(node_id).unwrap();
155-
let node_accessibility_state = node_ref.get::<AccessibilityNodeState>().unwrap();
156-
added_or_updated_ids.insert(
157-
node_accessibility_state
158-
.closest_accessibility_node_id
159-
.unwrap_or(rdom.root_id()),
160-
);
155+
let node_ref_parent = node_ref.parent_id().unwrap_or(rdom.root_id());
156+
added_or_updated_ids.insert(node_ref_parent);
161157
self.map
162158
.insert(node_ref.get_accessibility_id().unwrap(), node_id);
163159
}
164160

165161
// Mark the still existing ancenstors as modified
166-
for (node_id, ancestor_node_id) in removed_ids {
167-
added_or_updated_ids.insert(ancestor_node_id);
162+
for (_, ancestor_node_id) in removed_ids.iter() {
163+
added_or_updated_ids.insert(*ancestor_node_id);
164+
}
165+
166+
// Remove all the deleted noeds from the added_or_update list
167+
for (node_id, _) in removed_ids {
168+
added_or_updated_ids.remove(&node_id);
168169
self.map.retain(|_, id| *id != node_id);
169170
}
170171

@@ -180,7 +181,6 @@ impl AccessibilityTree {
180181
{
181182
let accessibility_node =
182183
Self::create_node(&node_ref, layout_node, node_accessibility_state);
183-
184184
let accessibility_id = node_ref.get_accessibility_id().unwrap();
185185

186186
nodes.push((accessibility_id, accessibility_node));
@@ -332,7 +332,18 @@ impl AccessibilityTree {
332332
let transform_state = &*node_ref.get::<TransformState>().unwrap();
333333
let node_type = node_ref.node_type();
334334

335-
let mut builder = NodeBuilder::new(Role::default());
335+
let mut builder = match node_type.tag() {
336+
// Make the root accessibility node.
337+
Some(&TagName::Root) => NodeBuilder::new(Role::Window),
338+
339+
// All other node types will either don't have a builder (but don't support
340+
// accessibility attributes like with `text`) or have their builder made for
341+
// them already.
342+
Some(_) => node_accessibility.builder.clone().unwrap(),
343+
344+
// Tag-less nodes can't have accessibility state
345+
None => unreachable!(),
346+
};
336347

337348
// Set children
338349
let children = node_ref.get_accessibility_children();
@@ -347,6 +358,14 @@ impl AccessibilityTree {
347358
y1: area.max_y(),
348359
});
349360

361+
if let NodeType::Element(node) = &*node_type {
362+
if matches!(node.tag, TagName::Label | TagName::Paragraph) && builder.name().is_none() {
363+
if let Some(inner_text) = node_ref.get_inner_texts() {
364+
builder.set_name(inner_text);
365+
}
366+
}
367+
}
368+
350369
// Set focusable action
351370
// This will cause assistive technology to offer the user an option
352371
// to focus the current element if it supports it.
@@ -453,28 +472,6 @@ impl AccessibilityTree {
453472
));
454473
}
455474

456-
// Set text value
457-
if let Some(alt) = &node_accessibility.a11y_alt {
458-
builder.set_value(alt.to_owned());
459-
} else if let Some(value) = node_ref.get_inner_texts() {
460-
builder.set_value(value);
461-
builder.set_role(Role::Label);
462-
}
463-
464-
// Set name
465-
if let Some(name) = &node_accessibility.a11y_name {
466-
builder.set_name(name.to_owned());
467-
}
468-
469-
// Set role
470-
if let Some(role) = node_accessibility.a11y_role {
471-
builder.set_role(role);
472-
}
473-
// Set root role
474-
if node_ref.id() == node_ref.real_dom().root_id() {
475-
builder.set_role(Role::Window);
476-
}
477-
478475
builder.build()
479476
}
480477
}

0 commit comments

Comments
 (0)