Add new accessibility functionalities to dashboard

This commit is contained in:
Eva 2022-12-27 08:54:34 +01:00
parent 9e190d9810
commit fcb8b15ef2
15 changed files with 625 additions and 145 deletions

View file

@ -8,6 +8,7 @@
(:require
[app.common.data.macros :as dm]
[app.common.files.features :as ffeat]
[app.common.geom.point :as gpt]
[app.common.logging :as log]
[app.main.data.dashboard :as dd]
[app.main.data.messages :as msg]
@ -251,7 +252,14 @@
(st/emit! (dd/clear-selected-files)))
(st/emit! (dd/toggle-file-select file)))
(let [position (dom/get-client-position event)]
(let [client-position (dom/get-client-position event)
position (if (and (nil? (:y client-position)) (nil? (:x client-position)))
(let [target-element (dom/get-target event)
points (dom/get-bounding-rect target-element)
y (:top points)
x (:left points)]
(gpt/point x y))
client-position)]
(swap! local assoc
:menu-open true
:menu-pos position))))
@ -277,7 +285,7 @@
(swap! local assoc :menu-open false)))
[:li.grid-item.project-th
[:a
[:button
{:tab-index "0"
:class (dom/classnames :selected selected?
:library library-view?)
@ -314,9 +322,11 @@
[:div.project-th-icon.menu
{:tab-index "0"
:ref menu-ref
:id (str file-id "-action-menu")
:on-click on-menu-click
:on-key-down (fn [event]
(when (kbd/enter? event)
(dom/stop-propagation event)
(on-menu-click event)))}
i/actions
(when selected?
@ -328,8 +338,8 @@
:on-edit on-edit
:on-menu-close on-menu-close
:origin origin
:dashboard-local dashboard-local}])]]]]]))
:dashboard-local dashboard-local
:parent-id (str file-id "-action-menu")}])]]]]]))
(mf/defc grid
[{:keys [files project origin limit library-view? create-fn] :as props}]