Skip to content

Commit c7b56db

Browse files
fix(mobile): opening Files no longer flies the sidebar's search across the thread on iOS
The sidebar's and the inspector's search toolbar items had no identifier, so UIKit treated them as one item and morphed the search field across the composer whenever the inspector replaced the sidebar. Give the inspector's search its own identifier; each column's search now leaves and arrives with its column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7798f45 commit c7b56db

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

‎apps/mobile/src/features/layout/inspector-host.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ const PANE_HEADER_OPTIONS = { ...GLASS_HEADER_OPTIONS, headerShown: false };
2323

2424
function PaneHeader(props: { readonly store: InspectorBarStore }) {
2525
const options = useSyncExternalStore(props.store.subscribe, props.store.getSnapshot);
26-
return <V5StackHeader options={{ ...PANE_HEADER_OPTIONS, ...options }} canGoBack={false} />;
26+
// Its own search identity, so opening the inspector doesn't morph the sidebar's search into it.
27+
return (
28+
<V5StackHeader
29+
options={{ ...PANE_HEADER_OPTIONS, ...options }}
30+
canGoBack={false}
31+
searchIdentifier="inspector-search"
32+
/>
33+
);
2734
}
2835

2936
function PaneScreenContent(props: {

‎apps/mobile/src/native/V5StackHeader.ios.tsx‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ export function V5StackHeader(props: {
156156
readonly column?: "primary" | "detail";
157157
/** The workspace's compose action, shown as its own group in this column's bar. */
158158
readonly onCompose?: () => void;
159+
/** UIKit morphs search items that share an identifier between bars as columns change. */
160+
readonly searchIdentifier?: string;
159161
}) {
160162
const { options } = props;
161163
const theme = useMobileNavigationTheme();
@@ -182,7 +184,14 @@ export function V5StackHeader(props: {
182184
const bottom = toolbar.flatMap<HeaderItem>((item, index) => {
183185
if (item.type === "mailSearchToolbar") return [];
184186
if (item.type === "searchBarPlacement")
185-
return [{ type: "item", id: `toolbar-search:${index}`, searchBarPlacement: true }];
187+
return [
188+
{
189+
type: "item",
190+
id: `toolbar-search:${index}`,
191+
searchBarPlacement: true,
192+
...(props.searchIdentifier ? { identifier: props.searchIdentifier } : {}),
193+
},
194+
];
186195
return convertItems([item], `toolbar:${index}`);
187196
});
188197
if (mailSearch) {
@@ -199,7 +208,12 @@ export function V5StackHeader(props: {
199208
if (bottomSearch) {
200209
if (spacesSearch && bottom.length)
201210
bottom.push({ type: "spacer", id: "before-search", sizing: "fixed", width: 8 });
202-
bottom.push({ type: "item", id: "home-search", searchBarPlacement: true });
211+
bottom.push({
212+
type: "item",
213+
id: "home-search",
214+
searchBarPlacement: true,
215+
...(props.searchIdentifier ? { identifier: props.searchIdentifier } : {}),
216+
});
203217
if (spacesSearch && mailSearch.onComposePress)
204218
bottom.push({ type: "spacer", id: "after-search", sizing: "fixed", width: 8 });
205219
}

0 commit comments

Comments
 (0)