Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 关闭任务抽屉时停用列表操作

Dash2ae9c7c552c2
diff --git a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
index 68af2e8698..0b697181d2 100644
--- a/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
+++ b/apps/mobile/src/__tests__/sessionListDrawerUpdates.test.tsx
@@ -26,6 +26,9 @@ vi.mock("react-native", async () => {
testID?: string;
onPress?: () => void;
accessibilityState?: { selected?: boolean };
+ pointerEvents?: string;
+ accessibilityElementsHidden?: boolean;
+ importantForAccessibility?: string;
ref?: import("react").Ref<HTMLDivElement>;
};
const View = ({
@@ -33,6 +36,9 @@ vi.mock("react-native", async () => {
testID,
onPress,
accessibilityState,
+ pointerEvents,
+ accessibilityElementsHidden,
+ importantForAccessibility,
ref,
}: Props) =>
createElement(
@@ -41,6 +47,9 @@ vi.mock("react-native", async () => {
"data-testid": testID,
onClick: onPress,
"aria-selected": accessibilityState?.selected,
+ "data-pointer-events": pointerEvents,
+ "data-accessibility-hidden": accessibilityElementsHidden,
+ "data-accessibility-importance": importantForAccessibility,
ref,
},
children,
@@ -191,8 +200,16 @@ describe('shared Home drawer host', () => {
it('unmounts the invisible blocker even when the animation never calls completion', async () => {
native.reduceMotion = false;
await act(async () => root.render(<SessionListDrawer {...props} />));
+ const content = () => container.querySelector('[data-testid="sessionDrawer.panel"]')!.firstElementChild!;
+ expect(content().getAttribute('data-pointer-events')).toBe('auto');
await act(async () => root.render(<SessionListDrawer {...props} open={false} />));
expect(container.querySelector('[data-testid="sessionDrawer.overlay"]')).not.toBeNull();
+ // PR #7079: RN's native input/accessibility contract must stop a second selection during
+ // exit; otherwise it updates lastTeammate while the coordinator retains the first route.
+ // Existing close-settlement coverage only checked eventual unmount. Unit tier, fake clock.
+ expect(content().getAttribute('data-pointer-events')).toBe('none');
+ expect(content().getAttribute('data-accessibility-hidden')).toBe('true');
+ expect(content().getAttribute('data-accessibility-importance')).toBe('no-hide-descendants');
expect(props.onClosed).not.toHaveBeenCalled();
// withTiming deliberately never delivers a completion in this test driver.
await act(async () => vi.advanceTimersByTime(motionDuration.exit));
@@ -208,6 +225,10 @@ describe('shared Home drawer host', () => {
await act(async () => root.render(<SessionListDrawer {...props} />));
await act(async () => vi.advanceTimersByTime(motionDuration.exit));
expect(container.querySelector('[data-testid="sessionDrawer.overlay"]')).not.toBeNull();
+ const content = container.querySelector('[data-testid="sessionDrawer.panel"]')!.firstElementChild!;
+ expect(content.getAttribute('data-pointer-events')).toBe('auto');
+ expect(content.getAttribute('data-accessibility-hidden')).toBe('false');
+ expect(content.getAttribute('data-accessibility-importance')).toBe('auto');
expect(props.onClosed).not.toHaveBeenCalled();
await act(async () => root.render(<SessionListDrawer {...props} open={false} />));
await act(async () => vi.advanceTimersByTime(motionDuration.exit));
diff --git a/apps/mobile/src/session/SessionListDrawer.tsx b/apps/mobile/src/session/SessionListDrawer.tsx
index 87152cb8c8..2bc8c8fb34 100644
--- a/apps/mobile/src/session/SessionListDrawer.tsx
+++ b/apps/mobile/src/session/SessionListDrawer.tsx
@@ -203,7 +203,10 @@ export function SessionListDrawer({ currentSessionId, persistent = false, newSes
<GestureDetector gesture={panGesture}>
<Animated.View style={[styles.panel, { paddingLeft: insets.left, paddingTop: topInset ?? insets.top, width: panelWidth },
!persistent && panelStyle]} testID="sessionDrawer.panel">
- <View ref={homeContentRef} style={styles.content}>
+ {/* The host keeps the first navigation intent. Stop all list input during exit so a
+ second selection cannot change preferences while its route is discarded. */}
+ <View ref={homeContentRef} style={styles.content} pointerEvents={open ? 'auto' : 'none'}
+ accessibilityElementsHidden={!open} importantForAccessibility={open ? 'auto' : 'no-hide-descendants'}>
<MobileHome newSessionActionRef={newSessionActionRef} width={width} currentSessionId={currentSessionId}
newSessionInSystemBar={newSessionInSystemBar} newSessionInHeader={!persistent}
onSelectSession={onSelectSession} runNavigation={runNavigation} />