From 89c6bad8cd1b9982c298be8fa52719bf2ebface2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?andr=C3=A9s=20gonz=C3=A1lez?= Date: Tue, 13 Oct 2026 12:56:48 +0200 Subject: [PATCH] :sparkles: Open files and projects in a new tab with Ctrl/Cmd+click (#12230) Ctrl+click (Cmd+click on macOS) on a dashboard file card, a project title, the "Show all files" button, or a project or Drafts item in the sidebar now opens it in a new browser tab. It reuses the same `::rt/new-window` navigation as the "Open in new tab" file menu option. On file cards the modifier click does not change the selection, and a modifier double click does not navigate the current tab. Files in the trash are not opened. Closes #12228 AI-assisted-by: claude-opus-5-5 --- frontend/src/app/main/ui/dashboard/grid.cljs | 30 ++++++++++++++----- .../src/app/main/ui/dashboard/projects.cljs | 8 +++-- .../src/app/main/ui/dashboard/sidebar.cljs | 11 ++++--- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index b46a0c53c1..7673e94573 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -23,6 +23,7 @@ [app.main.refs :as refs] [app.main.render :as render] [app.main.repo :as rp] + [app.main.router :as rt] [app.main.store :as st] [app.main.ui.components.color-bullet :as bc] [app.main.ui.dashboard.file-menu :refer [file-menu* file-menu-items*]] @@ -293,22 +294,35 @@ library-view? (= origin :libraries) + on-open-new-tab + (mf/use-fn + (mf/deps file-id can-restore) + (fn [] + (when-not can-restore + (st/emit! (dcm/go-to-workspace :file-id file-id ::rt/new-window true))))) + on-select (mf/use-fn - (mf/deps selected? selected-num) + (mf/deps selected? selected-num on-open-new-tab) (fn [event] - (when (or (not selected?) (> selected-num 1)) - (dom/stop-propagation event) - (let [shift? (kbd/shift? event)] - (when-not shift? - (st/emit! (dd/clear-selected-files))) - (st/emit! (dd/toggle-file-select file)))))) + (if (kbd/mod? event) + (do + (dom/stop-propagation event) + (on-open-new-tab)) + (when (or (not selected?) (> selected-num 1)) + (dom/stop-propagation event) + (let [shift? (kbd/shift? event)] + (when-not shift? + (st/emit! (dd/clear-selected-files))) + (st/emit! (dd/toggle-file-select file))))))) on-navigate (mf/use-fn (mf/deps file-id can-restore) (fn [event] - (when-not can-restore + ;; A Ctrl/Cmd double click has already opened the file in new + ;; tabs through on-select; the current tab stays where it is. + (when-not (or can-restore (kbd/mod? event)) (let [menu-icon (mf/ref-val menu-ref) target (dom/get-target event)] (when-not (dom/child? target menu-icon) diff --git a/frontend/src/app/main/ui/dashboard/projects.cljs b/frontend/src/app/main/ui/dashboard/projects.cljs index 2efbbefd21..ad7819e5b4 100644 --- a/frontend/src/app/main/ui/dashboard/projects.cljs +++ b/frontend/src/app/main/ui/dashboard/projects.cljs @@ -16,6 +16,7 @@ [app.main.data.project :as dpj] [app.main.data.team :as dtm] [app.main.refs :as refs] + [app.main.router :as rt] [app.main.store :as st] [app.main.ui.components.mcp-menu :refer [dashboard-mcp-menu*]] [app.main.ui.dashboard.deleted :as deleted] @@ -127,8 +128,9 @@ on-nav (mf/use-fn (mf/deps project-id) - (fn [] - (st/emit! (dcm/go-to-dashboard-files :project-id project-id)))) + (fn [event] + (st/emit! (dcm/go-to-dashboard-files :project-id project-id + ::rt/new-window (kbd/mod? event))))) toggle-pin (mf/use-fn @@ -286,7 +288,7 @@ :tab-index "0" :on-key-down (fn [event] (when (kbd/enter? event) - (on-nav)))} + (on-nav event)))} (tr "dashboard.show-all-files") [:> icon* {:icon-id i/arrow-right}]])]] diff --git a/frontend/src/app/main/ui/dashboard/sidebar.cljs b/frontend/src/app/main/ui/dashboard/sidebar.cljs index 2f37187244..b528a5c788 100644 --- a/frontend/src/app/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/app/main/ui/dashboard/sidebar.cljs @@ -89,8 +89,9 @@ on-click (mf/use-fn (mf/deps project-id) - (fn [] - (st/emit! (dcm/go-to-dashboard-files :project-id project-id)))) + (fn [event] + (st/emit! (dcm/go-to-dashboard-files :project-id project-id + ::rt/new-window (kbd/mod? event))))) on-key-down (mf/use-fn @@ -297,8 +298,10 @@ go-drafts (mf/use-fn (mf/deps team-id default-project-id) - (fn [] - (st/emit! (dcm/go-to-dashboard-files :team-id team-id :project-id default-project-id)))) + (fn [event] + (st/emit! (dcm/go-to-dashboard-files :team-id team-id + :project-id default-project-id + ::rt/new-window (kbd/mod? event))))) go-drafts-with-key (mf/use-fn