From b295d2f38d24027b5531b6bafe8be9847758f67d Mon Sep 17 00:00:00 2001 From: Richard R Date: Fri, 29 May 2026 21:58:45 -0600 Subject: [PATCH] feat(doclist): add mobile sidebar close handler to FinderWindow and DocumentList Introduce onRequestSidebarClose prop to FinderWindow and implement its usage in DocumentList to enable closing the sidebar on mobile via backdrop tap or Esc key. Enhances mobile usability by allowing users to dismiss the sidebar more intuitively. --- src/components/doclist/DocumentList.tsx | 3 +++ src/components/doclist/window/FinderWindow.tsx | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/doclist/DocumentList.tsx b/src/components/doclist/DocumentList.tsx index 08423d7..39d2c57 100644 --- a/src/components/doclist/DocumentList.tsx +++ b/src/components/doclist/DocumentList.tsx @@ -544,6 +544,9 @@ function DocumentListInner({ brand, appActions }: DocumentListInnerProps) { /> } sidebarOpen={effectiveSidebarOpen} + onRequestSidebarClose={() => { + if (isNarrow) setMobileSidebarOpen(false); + }} > {!isLoading && showHint && allDocuments.length > 1 && (
diff --git a/src/components/doclist/window/FinderWindow.tsx b/src/components/doclist/window/FinderWindow.tsx index 5926bdb..f8cb535 100644 --- a/src/components/doclist/window/FinderWindow.tsx +++ b/src/components/doclist/window/FinderWindow.tsx @@ -10,6 +10,8 @@ interface FinderWindowProps { children: ReactNode; /** Controlled sidebar open/closed state (drives mobile drawer + desktop collapse). */ sidebarOpen: boolean; + /** Handles close requests from mobile drawer interactions (backdrop tap, Esc). */ + onRequestSidebarClose?: () => void; } const NARROW_QUERY = '(max-width: 767px)'; @@ -37,6 +39,7 @@ export function FinderWindow({ statusBar, children, sidebarOpen, + onRequestSidebarClose, }: FinderWindowProps) { const isNarrow = useIsNarrow(); @@ -59,7 +62,7 @@ export function FinderWindow({ {/* Mobile drawer */} undefined} + onClose={onRequestSidebarClose ?? (() => undefined)} className="relative z-40 md:hidden" >