mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
♻️ Give the team page section links a real href (#12705)
Members, Invitations, Webhooks and Settings in the team page header were <a> elements without href: the keyboard could not reach them and they could not open in a new tab. Each one now links to its section; a plain click still runs the in-app navigation (prevent default), and Ctrl/Cmd-click opens the link in a new tab. The current section gets aria-current="page". They keep their look: the "Team header menu" visual test gives 0 px of difference at rest and on hover. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
cdfbff7c53
commit
1a355958a4
@ -48,22 +48,33 @@
|
||||
[app.util.dom :as dom]
|
||||
[app.util.forms :as uforms]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.timers :as tm]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(defn- nav-in-app
|
||||
"Click handler for a link with href: a plain click navigates inside the
|
||||
app; Ctrl/Cmd-click leaves the browser to open the href in a new tab."
|
||||
[event nav-event]
|
||||
(when-not (kbd/mod? event)
|
||||
(dom/prevent-default event)
|
||||
(st/emit! nav-event)))
|
||||
|
||||
(mf/defc header*
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [section team profile]}]
|
||||
(let [on-nav-members (mf/use-fn #(st/emit! (dcm/go-to-dashboard-members)))
|
||||
on-nav-settings (mf/use-fn #(st/emit! (dcm/go-to-dashboard-settings)))
|
||||
on-nav-invitations (mf/use-fn #(st/emit! (dcm/go-to-dashboard-invitations)))
|
||||
on-nav-webhooks (mf/use-fn #(st/emit! (dcm/go-to-dashboard-webhooks)))
|
||||
(let [on-nav-members (mf/use-fn #(nav-in-app % (dcm/go-to-dashboard-members)))
|
||||
on-nav-settings (mf/use-fn #(nav-in-app % (dcm/go-to-dashboard-settings)))
|
||||
on-nav-invitations (mf/use-fn #(nav-in-app % (dcm/go-to-dashboard-invitations)))
|
||||
on-nav-webhooks (mf/use-fn #(nav-in-app % (dcm/go-to-dashboard-webhooks)))
|
||||
|
||||
route (mf/deref refs/route)
|
||||
router (mf/deref refs/router)
|
||||
invite-email (-> route :query-params :invite-email)
|
||||
team-id (:id team)
|
||||
section-href #(rt/resolve-uri router % {:team-id team-id})
|
||||
|
||||
members-section? (= section :dashboard-team-members)
|
||||
settings-section? (= section :dashboard-team-settings)
|
||||
@ -110,20 +121,28 @@
|
||||
[:li
|
||||
[:a {:class (stl/css-case :dashboard-header-link true
|
||||
:active members-section?)
|
||||
:href (section-href :dashboard-members)
|
||||
:aria-current (when members-section? "page")
|
||||
:on-click on-nav-members} (tr "labels.members")]]
|
||||
(when is-admin?
|
||||
[:li
|
||||
[:a {:class (stl/css-case :dashboard-header-link true
|
||||
:active invitations-section?)
|
||||
:href (section-href :dashboard-invitations)
|
||||
:aria-current (when invitations-section? "page")
|
||||
:on-click on-nav-invitations} (tr "labels.invitations")]])
|
||||
(when (contains? cfg/flags :webhooks)
|
||||
[:li
|
||||
[:a {:class (stl/css-case :dashboard-header-link true
|
||||
:active webhooks-section?)
|
||||
:href (section-href :dashboard-webhooks)
|
||||
:aria-current (when webhooks-section? "page")
|
||||
:on-click on-nav-webhooks} (tr "labels.webhooks")]])
|
||||
[:li
|
||||
[:a {:class (stl/css-case :dashboard-header-link true
|
||||
:active settings-section?)
|
||||
:href (section-href :dashboard-settings)
|
||||
:aria-current (when settings-section? "page")
|
||||
:on-click on-nav-settings} (tr "labels.settings")]]]]
|
||||
[:div {:class (stl/css :dashboard-buttons)}
|
||||
(when (and is-admin?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user