The best way to control Claude Code, Codex and more from any computer or phone
test(web): the right panel Escape test advances fake frames until focus returns (#21118)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 18, 2026 at 00:17 UTC
c52453717acfd6125c22f7330c04073cf6f1a978
1 file changed
+7
-6
apps/web/src/components/RightPanelTabs.keyboard.browser.test.tsx
+7
-6
@@ -181,12 +181,13 @@ describe("right panel new-tab shortcut", () => {
181
expect(document.querySelector('[role="menu"]')).not.toBeNull();
182
await press("Escape");
183
expect(document.querySelector('[role="menu"]:not([data-closed])')).toBeNull();
184
- // The menu hands focus back to its trigger once its close finishes, which can land a frame later.
185
- await vi.waitFor(() =>
186
- expect(document.activeElement).toBe(
187
- container.querySelector('[aria-label="Add panel surface"]'),
188
- ),
189
- );
184
+ // The menu hands focus back to its trigger once its close finishes, a few frames later.
185
+ // Timers are fake here, so advance them instead of polling in real time.
186
+ const trigger = container.querySelector('[aria-label="Add panel surface"]');
187
+ for (let frame = 0; frame < 10 && document.activeElement !== trigger; frame++) {
188
+ await act(() => vi.advanceTimersToNextFrame());
189
+ }
190
+ expect(document.activeElement).toBe(trigger);
191
input.remove();
192
});
193