@devries-cameron20 / t3code Mirror · read-only / commits / 0629735d37
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 23:30 UTC

fix(web): thread controls hide while the mobile sidebar is open (#27490)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 11, 2026 at 09:08 UTC 0629735d37ca8ce876f4e7b0fcbc5afa8ecfc230
4 files changed +28 -6
apps/web/src/components/AppSidebarLayout.tsx
+4 -2
@@ -57,6 +57,7 @@ import {
57 SidebarProvider,
58 SidebarRail,
59 SidebarTrigger,
60 + useMobileSidebarSheetMounted,
61 useSidebar,
62 useSidebarVisibility,
63 } from "./ui/sidebar";
@@ -316,7 +317,8 @@ function SidebarControl({ showSidebar }: { readonly showSidebar: boolean }) {
317 const router = useRouter();
318 const usagePageOpen = useLocation({ select: (location) => location.pathname === "/usage" });
319 const keybindings = useAtomValue(primaryServerKeybindingsAtom);
319 - const { toggleSidebar, isMobile, mobileSheetMounted } = useSidebar();
320 + const { toggleSidebar } = useSidebar();
321 + const mobileSidebarSheetMounted = useMobileSidebarSheetMounted();
322 const isSidebarVisible = useSidebarVisibility();
323 const environmentIdentificationMode = useEnvironmentIdentificationMode();
324 const stageBackdropVariant = useSidebarStageBackdropVariant(environmentIdentificationMode);
@@ -378,7 +380,7 @@ function SidebarControl({ showSidebar }: { readonly showSidebar: boolean }) {
380 ref={appShellCommandsRef}
381 className={cn(
382 "pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 ml-px flex h-[var(--workspace-topbar-height)] items-center",
381 - isMobile && mobileSheetMounted && "hidden",
383 + mobileSidebarSheetMounted && "hidden",
384 )}
385 data-sidebar-control=""
386 >
apps/web/src/components/chat/PanelLayoutControls.tsx
+11 -2
@@ -11,6 +11,7 @@ import { cn } from "~/lib/utils";
11
12 import type { ThreadPanelPresentation } from "../../rightPanelLayout";
13 import { PopoverCreateHandle, PopoverTrigger } from "../ui/popover";
14 +import { useMobileSidebarSheetMounted } from "../ui/sidebar";
15 import { Toggle } from "../ui/toggle";
16 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
17
@@ -171,9 +172,13 @@ export const RightPanelMaximizeControl = memo(function RightPanelMaximizeControl
172
173 /** The thread panel toggle on a header whose right side the inline right panel covers. */
174 export function ThreadPanelHeaderControl(props: PanelLayoutControlsProps) {
175 + const mobileSidebarSheetMounted = useMobileSidebarSheetMounted();
176 return (
177 <div
176 - className="absolute top-[var(--workspace-controls-top)] right-[calc(env(safe-area-inset-right)+0.75rem)] z-50 flex h-[var(--workspace-topbar-height)] items-center [-webkit-app-region:no-drag]"
178 + className={cn(
179 + "absolute top-[var(--workspace-controls-top)] right-[calc(env(safe-area-inset-right)+0.75rem)] z-50 flex h-[var(--workspace-topbar-height)] items-center [-webkit-app-region:no-drag]",
180 + mobileSidebarSheetMounted && "hidden",
181 + )}
182 data-workspace-titlebar-controls
183 >
184 <PanelLayoutControls {...props} showTerminalControl={false} showRightPanelControl={false} />
@@ -190,9 +195,13 @@ export function WorkspaceTitlebarControls(props: {
195 readonly onToggleMaximized: () => void;
196 readonly children: ReactNode;
197 }) {
198 + const mobileSidebarSheetMounted = useMobileSidebarSheetMounted();
199 return (
200 <div
195 - className="pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] z-50 mr-px flex h-[var(--workspace-topbar-height)] items-center gap-1 [-webkit-app-region:no-drag]"
201 + className={cn(
202 + "pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] z-50 mr-px flex h-[var(--workspace-topbar-height)] items-center gap-1 [-webkit-app-region:no-drag]",
203 + mobileSidebarSheetMounted && "hidden",
204 + )}
205 data-workspace-titlebar-controls
206 >
207 {props.showMaximizeControl ? (
apps/web/src/components/pullRequest/PullRequestsPage.tsx
+6 -2
@@ -86,7 +86,7 @@ import { registerCommands } from "~/shortcuts/dispatcher";
86 import { isTerminalFocused } from "~/lib/terminalFocus";
87 import { PanelLayoutControls, RightPanelMaximizeControl } from "../chat/PanelLayoutControls";
88 import { Button } from "../ui/button";
89 -import { SidebarInset } from "../ui/sidebar";
89 +import { SidebarInset, useMobileSidebarSheetMounted } from "../ui/sidebar";
90 import { useLiveRefresh } from "~/hooks/useLiveRefresh";
91 import { useStableCallback } from "~/hooks/useStableCallback";
92 import { useOpenPanelPullRequestUrl } from "~/hooks/useOpenPanelPullRequestUrl";
@@ -1045,6 +1045,7 @@ export function PullRequestsPage() {
1045 },
1046 );
1047 const rightPanelAvailable = selectedPullRequestSurface !== null;
1048 + const mobileSidebarSheetMounted = useMobileSidebarSheetMounted();
1049 const [maximized, setMaximized] = useState(false);
1050 const rightPanelMaximized = rightPanelState.isOpen && maximized;
1051 if (!rightPanelState.isOpen && maximized) setMaximized(false);
@@ -1160,7 +1161,10 @@ export function PullRequestsPage() {
1161 );
1162 const openPanelControls = (
1163 <div
1163 - className="absolute top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] z-50 mr-px flex h-[var(--workspace-topbar-height)] items-center gap-1 [-webkit-app-region:no-drag]"
1164 + className={cn(
1165 + "absolute top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] z-50 mr-px flex h-[var(--workspace-topbar-height)] items-center gap-1 [-webkit-app-region:no-drag]",
1166 + mobileSidebarSheetMounted && "hidden",
1167 + )}
1168 data-workspace-titlebar-controls
1169 >
1170 {rightPanelState.isOpen ? (
apps/web/src/components/ui/sidebar.tsx
+7
@@ -98,6 +98,12 @@ function useSidebarVisibility() {
98 return isMobile ? openMobile : open;
99 }
100
101 +/** Whether the mobile sidebar sheet covers the page; false outside a SidebarProvider. */
102 +function useMobileSidebarSheetMounted() {
103 + const context = React.use(SidebarContext);
104 + return context !== null && context.isMobile && context.mobileSheetMounted;
105 +}
106 +
107 // The `max-md` breakpoint, also read when a shortcut fires.
108 const SIDEBAR_MOBILE_QUERY = "(max-width: 767px)";
109
@@ -869,6 +875,7 @@ export {
875 SidebarProvider,
876 SidebarRail,
877 SidebarTrigger,
878 + useMobileSidebarSheetMounted,
879 useSidebar,
880 useSidebarVisibility,
881 };