Skip to content

Commit 392324a

Browse files
authored
feat: Rename a11y attributes (#869)
* feat: Rename a11y attributes * chore: Fixes and clean up * chore: clean up * fixes * fixes * fix: fix parsing of a11y_focusable
1 parent 48163f5 commit 392324a

File tree

21 files changed

+123
-123
lines changed

21 files changed

+123
-123
lines changed

crates/components/src/button.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn Button(
9292
let mut status = use_signal(ButtonStatus::default);
9393
let platform = use_platform();
9494

95-
let focus_id = focus.attribute();
95+
let a11y_id = focus.attribute();
9696

9797
let ButtonTheme {
9898
background,
@@ -175,14 +175,14 @@ pub fn Button(
175175
onmouseenter,
176176
onmouseleave,
177177
onkeydown,
178-
focus_id,
178+
a11y_id,
179179
width: "{width}",
180180
height: "{height}",
181181
padding: "{padding}",
182182
margin: "{margin}",
183-
focusable: "true",
183+
a11y_focusable: "true",
184184
overflow: "clip",
185-
role: "button",
185+
a11y_role:"button",
186186
color: "{font_theme.color}",
187187
shadow: "{shadow}",
188188
border: "{border}",

crates/components/src/dropdown.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ where
6666
let mut status = use_signal(DropdownItemStatus::default);
6767
let platform = use_platform();
6868

69-
let focus_id = focus.attribute();
69+
let a11y_id = focus.attribute();
7070
let is_focused = focus.is_focused();
7171
let is_selected = *selected.read() == value;
7272

@@ -115,8 +115,8 @@ where
115115
rect {
116116
width: "fill-min",
117117
color: "{color}",
118-
focus_id,
119-
role: "button",
118+
a11y_id,
119+
a11y_role:"button",
120120
background: "{background}",
121121
padding: "6 22 6 16",
122122
corner_radius: "6",
@@ -194,7 +194,7 @@ where
194194

195195
let is_opened = *opened.read();
196196
let is_focused = focus.is_focused();
197-
let focus_id = focus.attribute();
197+
let a11y_id = focus.attribute();
198198

199199
// Update the provided value if the passed value changes
200200
use_effect(use_reactive(&props.value, move |value| {
@@ -269,7 +269,7 @@ where
269269
onclick,
270270
onkeydown,
271271
margin: "{margin}",
272-
focus_id,
272+
a11y_id,
273273
background: "{button_background}",
274274
color: "{font_theme.color}",
275275
corner_radius: "8",

crates/components/src/input.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub fn Input(
165165
_ => {}
166166
};
167167

168-
let focus_id = focus.attribute();
168+
let a11y_id = focus.attribute();
169169
let cursor_reference = editable.cursor_attr();
170170
let highlights = editable.highlights_attr(0);
171171

@@ -211,9 +211,9 @@ pub fn Input(
211211
corner_radius: "{corner_radius}",
212212
margin: "{margin}",
213213
cursor_reference,
214-
focus_id,
215-
focusable: "true",
216-
role: "textInput",
214+
a11y_id,
215+
a11y_focusable: "true",
216+
a11y_role:"textInput",
217217
main_align: "center",
218218
paragraph {
219219
margin: "8 12",

crates/components/src/menu.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn MenuItem(
148148
let mut status = use_signal(MenuItemStatus::default);
149149
let platform = use_platform();
150150

151-
let focus_id = focus.attribute();
151+
let a11y_id = focus.attribute();
152152
let click = &onclick;
153153

154154
let MenuItemTheme {
@@ -197,12 +197,12 @@ pub fn MenuItem(
197197
onclick,
198198
onmouseenter,
199199
onmouseleave,
200-
focus_id,
200+
a11y_id,
201201
width: "fill-min",
202202
padding: "6",
203203
margin: "2",
204-
focusable: "true",
205-
role: "button",
204+
a11y_focusable: "true",
205+
a11y_role:"button",
206206
color: "{font_theme.color}",
207207
corner_radius: "{corner_radius}",
208208
background: "{background}",

crates/components/src/network_image.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn NetworkImage(props: NetworkImageProps) -> Element {
7070
let mut cached_assets = use_signal::<Vec<AssetConfiguration>>(Vec::new);
7171
let mut assets_tasks = use_signal::<Vec<Task>>(Vec::new);
7272

73-
let focus_id = focus.attribute();
73+
let a11y_id = focus.attribute();
7474
let NetworkImageTheme { width, height } = use_applied_theme!(&props.theme, network_image);
7575
let alt = props.alt.as_deref();
7676

@@ -121,10 +121,10 @@ pub fn NetworkImage(props: NetworkImageProps) -> Element {
121121
rsx!(image {
122122
height: "{height}",
123123
width: "{width}",
124-
focus_id,
124+
a11y_id,
125125
image_data,
126-
role: "image",
127-
alt
126+
a11y_role: "image",
127+
a11y_alt: 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-
role: "scrollBar",
59+
a11y_role:"scrollBar",
6060
width: "{width}",
6161
height: "{height}",
6262
offset_x: "{offset_x}",

crates/components/src/scroll_views/scroll_view.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ pub fn ScrollView(
363363
.map(|f| f.0 == Axis::Y)
364364
.unwrap_or_default();
365365

366-
let focus_id = focus.attribute();
366+
let a11y_id = focus.attribute();
367367

368368
rsx!(
369369
rect {
370-
role: "scrollView",
370+
a11y_role:"scrollView",
371371
overflow: "clip",
372372
direction: "horizontal",
373373
width,
@@ -376,7 +376,7 @@ pub fn ScrollView(
376376
onglobalmousemove: onmousemove,
377377
onkeydown,
378378
onkeyup,
379-
focus_id,
379+
a11y_id,
380380
rect {
381381
direction: "vertical",
382382
width: "{container_width}",

crates/components/src/scroll_views/virtual_scroll_view.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,11 @@ pub fn VirtualScrollView<
437437
let offset_y_min = (-corrected_scrolled_y / item_size).floor() * item_size;
438438
let offset_y = -corrected_scrolled_y - offset_y_min;
439439

440-
let focus_id = focus.attribute();
440+
let a11y_id = focus.attribute();
441441

442442
rsx!(
443443
rect {
444-
role: "scrollView",
444+
a11y_role:"scrollView",
445445
overflow: "clip",
446446
direction: "horizontal",
447447
width: "{width}",
@@ -450,7 +450,7 @@ pub fn VirtualScrollView<
450450
onglobalmousemove: onmousemove,
451451
onkeydown,
452452
onkeyup,
453-
focus_id,
453+
a11y_id,
454454
rect {
455455
direction: "vertical",
456456
width: "{container_width}",

crates/components/src/slider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn Slider(
9999
let (node_reference, size) = use_node();
100100

101101
let value = ensure_correct_slider_range(value);
102-
let focus_id = focus.attribute();
102+
let a11y_id = focus.attribute();
103103

104104
use_drop(move || {
105105
if *status.peek() == SliderStatus::Hovering {
@@ -176,7 +176,7 @@ pub fn Slider(
176176
height: "20",
177177
onmousedown,
178178
onglobalclick: onclick,
179-
focus_id,
179+
a11y_id,
180180
onmouseenter,
181181
onglobalmousemove: onmousemove,
182182
onmouseleave,

crates/components/src/switch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub fn Switch(props: SwitchProps) -> Element {
9898
let mut status = use_signal(SwitchStatus::default);
9999
let mut focus = use_focus();
100100

101-
let focus_id = focus.attribute();
101+
let a11y_id = focus.attribute();
102102

103103
use_drop(move || {
104104
if *status.read() == SwitchStatus::Hovering {
@@ -171,7 +171,7 @@ pub fn Switch(props: SwitchProps) -> Element {
171171
onmouseleave,
172172
onkeydown,
173173
onclick,
174-
focus_id,
174+
a11y_id,
175175
offset_x: "{offset_x}",
176176
main_align: "center",
177177
rect {

0 commit comments

Comments
 (0)