Skip to content

Commit 4737b73

Browse files
committed
enhance dialog a11y
1 parent c4d14d9 commit 4737b73

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/renderer/dialog/cmdk.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
(defn root
4141
[]
4242
[:> Command/Command
43-
{:on-key-down #(when-not (= (.-key %) "Escape") (.stopPropagation %))}
43+
{:label "Command Menu"
44+
:on-key-down #(when-not (= (.-key %) "Escape") (.stopPropagation %))}
4445
[:> Command/CommandInput
4546
{:placeholder (t [:cmdk/search-command "Search for a command"])}]
4647
[:> Command/CommandList

src/renderer/dialog/events.cljs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
(rf/reg-event-db
1414
::about
1515
(fn [db [_]]
16-
(update db :dialogs conj {:content [v/about]})))
16+
(update db :dialogs conj {:title "Repath Studio"
17+
:content [v/about]})))
1718

1819
(rf/reg-event-fx
1920
::save
2021
(fn [{:keys [db]} [_ k]]
21-
{:db (update db :dialogs conj {:content [v/save k]
22+
{:db (update db :dialogs conj {:title "Do you want to save your changes?"
23+
:content [v/save k]
2224
:attrs {:onOpenAutoFocus #(.preventDefault %)}})}))
2325

2426
#_(rf/reg-event-db

src/renderer/dialog/views.cljs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
[:div.p-4
2323
[:div.flex.gap-3.items-start.pb-2
2424
[:div
25-
[:h1.text-3xl.font-light.mb-2 "Repath Studio"]
2625
[:div [:strong "Version: "] config/version]
2726
[:div [:strong "Browser: "] platform/user-agent]]]
2827
[:button.button.px-2.bg-primary.rounded.w-full
@@ -51,8 +50,6 @@
5150
[k]
5251
(let [document @(rf/subscribe [::document.s/document k])]
5352
[:div.p-4
54-
[:h1.text-xl.mb-2
55-
"Do you want to save your changes?"]
5653
[:p
5754
"Your changes to " [:strong (:title document)]
5855
" will be lost if you close the document without saving."]
@@ -80,6 +77,14 @@
8077
[:> Dialog/Portal
8178
[:> Dialog/Overlay {:class "backdrop"}]
8279
[:> Dialog/Content
83-
(merge {:class "dialog-content"}
80+
81+
(merge {:class "dialog-content"
82+
:on-key-down #(.stopPropagation %)}
8483
(:attrs (last dialogs)))
85-
(:content (last dialogs))]]]))
84+
(when-let [title (:title (last dialogs))]
85+
[:> Dialog/Title
86+
{:class "text-xl px-4 pt-4"}
87+
title])
88+
[:> Dialog/Description
89+
{:class "m-0"}
90+
(:content (last dialogs))]]]]))

0 commit comments

Comments
 (0)