From a92a1785ffeb24005ab8a9aa974642c58dca0a74 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 09:38:27 -0400 Subject: [PATCH] Enable CMD+Shift+L theme toggle on publicly shared pages (#11750) * Initial plan * Add CMD+Shift+L keyboard shortcut to toggle theme on shared pages Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> --- app/scenes/Shared/index.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/scenes/Shared/index.tsx b/app/scenes/Shared/index.tsx index afef306f66..45cd9f0e45 100644 --- a/app/scenes/Shared/index.tsx +++ b/app/scenes/Shared/index.tsx @@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next"; import { useLocation, useParams } from "react-router-dom"; import styled, { ThemeProvider } from "styled-components"; import { s } from "@shared/styles"; +import { isModKey } from "@shared/utils/keyboard"; import type { NavigationNode } from "@shared/types"; import Collection from "~/models/Collection"; import Document from "~/models/Document"; @@ -18,9 +19,11 @@ import Text from "~/components/Text"; import env from "~/env"; import useBuildTheme from "~/hooks/useBuildTheme"; import useCurrentUser from "~/hooks/useCurrentUser"; +import useKeyDown from "~/hooks/useKeyDown"; import { usePostLoginPath } from "~/hooks/useLastVisitedPath"; import useRequest from "~/hooks/useRequest"; import useStores from "~/hooks/useStores"; +import { Theme } from "~/stores/UiStore"; import { client } from "~/utils/ApiClient"; import { AuthorizationError, OfflineError } from "~/utils/errors"; import isCloudHosted from "~/utils/isCloudHosted"; @@ -151,6 +154,20 @@ function SharedScene() { ) ); + useKeyDown( + useCallback( + (ev: KeyboardEvent) => isModKey(ev) && ev.shiftKey && ev.code === "KeyL", + [] + ), + useCallback(() => { + if (!ui.themeOverride) { + ui.setTheme( + ui.resolvedTheme === "light" ? Theme.Dark : Theme.Light + ); + } + }, [ui]) + ); + useEffect(() => { if (!user) { void changeLanguage(detectLanguage(), i18n);