Skip to content

Commit a5e361e

Browse files
committed
fix various a11y issues
1 parent 3214dee commit a5e361e

File tree

15 files changed

+40
-21
lines changed

15 files changed

+40
-21
lines changed

src/renderer/attribute/impl/angle.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
[v/form-input k v attrs]
1313
[:> Popover/Root {:modal true}
1414
[:> Popover/Trigger
15-
{:class "form-control-button"}
15+
{:title "Pick angle"
16+
:class "form-control-button"}
1617
[ui/icon "degrees"]]
1718
[:> Popover/Portal
1819
[:> Popover/Content

src/renderer/attribute/impl/color.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
{:as-child true
2222
:disabled disabled}
2323
[:button.button.color-drip.inline-block
24-
{:style {:border "5px solid var(--bg-primary)"
24+
{:title "Pick color"
25+
:style {:border "5px solid var(--bg-primary)"
2526
:background v}}]]
2627
[:> Popover/Portal
2728
[:> Popover/Content

src/renderer/attribute/impl/d.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@
139139
(when v
140140
[:> Popover/Root {:modal true}
141141
[:> Popover/Trigger
142-
{:class "form-control-button"}
142+
{:title "Edit path"
143+
:class "form-control-button"}
143144
[ui/icon "pencil"]]
144145
[:> Popover/Portal
145146
[:> Popover/Content {:sideOffset 5

src/renderer/attribute/impl/font_family.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
(when (and state (empty? suggestions))
5151
(rf/dispatch [::app.e/query-local-fonts])))}
5252
[:> Popover/Trigger
53-
{:class "form-control-button"
53+
{:title "Select font"
54+
:class "form-control-button"
5455
:disabled (:disabled attrs)}
5556
[ui/icon "magnifier"]]
5657
[:> Popover/Portal

src/renderer/attribute/impl/length.cljs

+2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
[:div.flex.gap-px
4242
[:button.form-control-button
4343
{:disabled disabled
44+
:title "Decrease"
4445
:on-pointer-down #(rf/dispatch [::element.e/update-attr k - 1])}
4546
[ui/icon "minus"]]
4647
[:button.form-control-button
4748
{:disabled disabled
49+
:title "Increase"
4850
:on-click #(rf/dispatch [::element.e/update-attr k + 1])}
4951
[ui/icon "plus"]]]])
5052

src/renderer/attribute/impl/points.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
[points]
4242
[:> Popover/Root {:modal true}
4343
[:> Popover/Trigger
44-
{:class "form-control-button"}
44+
{:title "Edit points"
45+
:class "form-control-button"}
4546
[ui/icon "pencil"]]
4647
[:> Popover/Portal
4748
[:> Popover/Content

src/renderer/attribute/views.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
:disabled disabled}
131131
[:> Select/Trigger
132132
{:class "form-control-button"
133-
:aria-label (name k)}
133+
:aria-label (str "Select " (name k))}
134134
[:> Select/Value ""]
135135
[:> Select/Icon
136136
[ui/icon "chevron-down"]]]

src/renderer/document/views.cljs

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
[:> DropdownMenu/Trigger
143143
{:as-child true}
144144
[:button.button.flex.items-center.justify-center.aria-expanded:overlay.px-2.font-mono.rounded
145+
{:aria-label "More document actions"}
145146
[ui/icon "ellipsis-h"]]]
146147
[:> DropdownMenu/Portal
147148
[:> DropdownMenu/Content

src/renderer/snap/views.cljs

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
(let [options @(rf/subscribe [::snap.s/options])]
1717
[:> DropdownMenu/Root
1818
[:> DropdownMenu/Trigger
19-
{:aria-label "Snap"
20-
:as-child true}
19+
{:as-child true}
2120
[:div.h-full.flex.items-center
22-
{:class "hover:pb-1"}
21+
{:role "button"
22+
:title "Snap options"
23+
:class "hover:pb-1"}
2324
[ui/icon "chevron-up"]]]
2425
[:> DropdownMenu/Portal
2526
[:> DropdownMenu/Content

src/renderer/theme/styles.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--text-2xs--line-height: 14px;
1010
--transition-property-fill: fill;
1111

12-
--color-accent: #e93976;
12+
--color-accent: #d12b65;
1313
--color-accent-inverted: #fff;
1414
}
1515

src/renderer/toolbar/status.cljs

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
[]
5555
[:> DropdownMenu/Root
5656
[:> DropdownMenu/Trigger
57-
{:class "button flex items-center justify-center overlay px-2 font-mono rounded-sm"
57+
{:title "Select zoom level"
58+
:class "button flex items-center justify-center overlay px-2 font-mono rounded-sm"
5859
:side "top"}
5960
[:div.flex.items-center
6061
[ui/icon "chevron-up"]]]
@@ -162,7 +163,8 @@
162163
:on-change #(rf/dispatch [::document.e/preview-attr :fill (get-hex %)])}
163164

164165
[:button.button.color-rect
165-
{:style {:background fill}}]]
166+
{:title "Pick fill color"
167+
:style {:background fill}}]]
166168

167169
[:button.icon-button
168170
{:title (t [:color/swap "Swap fill with stroke"])
@@ -176,7 +178,8 @@
176178
:on-change #(rf/dispatch [::document.e/preview-attr :stroke (get-hex %)])
177179
:align-offset -54}
178180
[:button.button.color-rect.relative
179-
{:style {:background stroke}}
181+
{:title "Pick stroke color"
182+
:style {:background stroke}}
180183
[:div.color-rect.bg-primary.absolute
181184
{:style {:width "13px"
182185
:height "13px"

src/renderer/toolbar/tools.cljs

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@
1414
primary-tool @(rf/subscribe [::tool.s/primary])
1515
active (= active-tool tool)
1616
primary (= primary-tool tool)
17-
properties (tool.hierarchy/properties tool)]
17+
properties (tool.hierarchy/properties tool)
18+
label (or (:label properties) (str/capitalize (name tool)))]
1819
(when (:icon properties)
1920
[:> Tooltip/Root
2021
[:> Tooltip/Trigger {:as-child true}
2122
[:span
2223
[ui/radio-icon-button (:icon properties) active
2324
{:class (when primary "outline-shadow")
25+
:aria-label (str "activate " label)
2426
:on-click #(rf/dispatch [::tool.e/activate tool])}]]]
2527
[:> Tooltip/Portal
2628
[:> Tooltip/Content
2729
{:class "tooltip-content"
2830
:sideOffset 5
2931
:side "top"}
3032
[:div.flex.gap-2.items-center
31-
(or (:label properties) (str/capitalize (name tool)))]]]])))
33+
(or (:label properties)
34+
(str/capitalize (name tool)))]]]])))
3235

3336
(defn group
3437
[items]

src/renderer/toolbar/views.cljs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
{:as-child true}
1414
[:span.shadow-4
1515
[ui/icon-button icon {:disabled disabled
16+
:aria-label title
1617
:on-click #(rf/dispatch action)}]]]
1718
[:> Tooltip/Portal
1819
[:> Tooltip/Content

src/renderer/tree/views.cljs

+7-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
(when hovered "hovered")]
132132
:tab-index 0
133133
:data-id (str id)
134-
:role "menuitem"
135134
:on-double-click #(rf/dispatch [::frame.e/pan-to-element id])
136135
:on-pointer-enter #(rf/dispatch [::document.e/set-hovered-id id])
137136
:ref (fn [this]
@@ -170,20 +169,23 @@
170169
hovered-ids @(rf/subscribe [::document.s/hovered-ids])
171170
collapsed-ids @(rf/subscribe [::document.s/collapsed-ids])
172171
collapsed (contains? collapsed-ids id)]
173-
[:li {:class (when selected "overlay")}
172+
[:li {:class (when selected "overlay")
173+
:role "menuitem"}
174174
[list-item-button el {:depth depth
175175
:collapsed collapsed
176176
:hovered (contains? hovered-ids id)}]
177177
(when (and has-children (not collapsed))
178-
[:ul (for [el (mapv (fn [k] (get elements k)) (reverse children))]
179-
^{:key (:id el)} [item el (inc depth) elements])])]))
178+
[:ul {:role "menu"}
179+
(for [el (mapv (fn [k] (get elements k)) (reverse children))]
180+
^{:key (:id el)} [item el (inc depth) elements])])]))
180181

181182
(defn inner-sidebar-render
182183
[root-children elements]
183184
[:div.tree-sidebar
184185
{:on-pointer-up #(rf/dispatch [::element.e/deselect-all])}
185186
[ui/scroll-area
186-
[:ul {:on-pointer-leave #(rf/dispatch [::document.e/clear-hovered])
187+
[:ul {:role "menu"
188+
:on-pointer-leave #(rf/dispatch [::document.e/clear-hovered])
187189
:style {:width "227px"}}
188190
(for [el (reverse root-children)]
189191
^{:key (:id el)} [item el 1 elements])]]])

src/renderer/ui.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
props)
6363
[:> Slider/Track {:class "relative h-1 bg-secondary flex-1"}
6464
[:> Slider/Range {:class "absolute h-full overlay"}]]
65-
[:> Slider/Thumb {:class "slider-thumb"}]])
65+
[:> Slider/Thumb {:class "slider-thumb"
66+
:aria-label "Resize panel thumb"}]])
6667

6768
(defn format-shortcut
6869
[[shortcut]]

0 commit comments

Comments
 (0)