From fdd520f901c4f7ff9aa43558dae0ef6482f5fa5c Mon Sep 17 00:00:00 2001 From: Saafo <46736350+Saafo@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Keep=20sidebar=20focus=20h?= =?UTF-8?q?andling=20out=20of=20ui-layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/ui-layout/package.json | 3 +- .../client/ui-layout/src/client/AppFrame.tsx | 11 +---- .../ui-layout/tests/app-frame.client.spec.tsx | 24 ----------- packages/client/ui-layout/tsconfig.json | 4 -- packages/client/ui-sidebar/README.i18n.yaml | 4 +- packages/client/ui-sidebar/README.md | 2 +- packages/client/ui-sidebar/README.zh.md | 2 +- .../src/client/HeaderLeadingControls.tsx | 1 + .../ui-sidebar/src/client/SidebarRoot.tsx | 11 ++++- .../tests/sidebar-root.client.spec.tsx | 43 +++++++++++++++++-- pnpm-lock.yaml | 3 -- 11 files changed, 55 insertions(+), 53 deletions(-) diff --git a/packages/client/ui-layout/package.json b/packages/client/ui-layout/package.json index ce216ab52f..a233d3410a 100644 --- a/packages/client/ui-layout/package.json +++ b/packages/client/ui-layout/package.json @@ -56,8 +56,7 @@ "@deepseek-ai/dsh-client-ui-theme": "workspace:*", "@deepseek-ai/cordis": "workspace:~", "react": "^18.2.0", - "@deepseek-ai/dsh-client-shortcuts": "workspace:*", - "@deepseek-ai/dsh-client-ui-primitives": "workspace:*" + "@deepseek-ai/dsh-client-shortcuts": "workspace:*" }, "files": [ "locale/*.json", diff --git a/packages/client/ui-layout/src/client/AppFrame.tsx b/packages/client/ui-layout/src/client/AppFrame.tsx index 7ffcb49a24..14b64dd92b 100644 --- a/packages/client/ui-layout/src/client/AppFrame.tsx +++ b/packages/client/ui-layout/src/client/AppFrame.tsx @@ -16,7 +16,6 @@ */ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import type { ReactNode } from 'react' -import { focusWithoutRing, isBehindModal } from '@deepseek-ai/dsh-client-ui-primitives' import type { HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore, } from '@deepseek-ai/dsh-client-ui-slots' @@ -138,8 +137,6 @@ export function AppFrame({ }: AppFrameProps) { const layoutInfo = useStore(state => state.layoutInfo) const frameRef = useRef(null) - const leadingSeat = useRef(null) - const sidebarFocus = useRef(null) const viewport = layoutInfo.viewportWidth const foldedLandscape = useFoldedLandscape(matches => matches) @@ -176,11 +173,6 @@ export function AppFrame({ const centeredSidebar = foldedLandscape && viewport >= SIDEBAR_DRAWER_BREAKPOINT const sidebarCollapsed = narrow ? !layoutInfo.narrowExpanded : layoutInfo.sidebar === 0 const drawerOpen = drawer && !sidebarCollapsed - useLayoutEffect(() => { - if (!drawer || !sidebarCollapsed || sidebarFocus.current !== document.activeElement) return - const opener = leadingSeat.current?.querySelector('button') - if (opener != null && !isBehindModal(opener)) focusWithoutRing(opener, { preventScroll: true }) - }, [drawer, sidebarCollapsed]) // Entering drawer mode from a collapsed rail hides the backing immediately. const [sidebarTransition, setSidebarTransition] = useState({ drawer, collapsed: sidebarCollapsed, instant: true }) if (sidebarTransition.drawer !== drawer || sidebarTransition.collapsed !== sidebarCollapsed) { @@ -322,7 +314,6 @@ export function AppFrame({ {drawer &&