setMachineId(null)}
onKeyDown={(event) => {
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') setMachineId(null);
diff --git a/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx b/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx
index cbc002d719..9f71871000 100644
--- a/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx
+++ b/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx
@@ -461,7 +461,7 @@ describe('CodeWorkspaceMenu', () => {
const setter = jest.fn();
renderMenu();
expect(screen.getByTestId('code-machine')).toBeDisabled();
- expect(screen.getByTestId('code-workspace')).toBeDisabled();
+ expect(screen.getByTestId('code-workspace')).toHaveAttribute('aria-disabled', 'true');
expect(screen.getByRole('checkbox')).toBeDisabled();
await userEvent.click(screen.getByRole('checkbox'));
expect(setter).not.toHaveBeenCalled();
@@ -661,6 +661,77 @@ describe('CodeWorkspaceMenu', () => {
},
);
+ test.each([false, true])(
+ 'keeps changing diagnostics keyboard-reachable without enabling actions (locked: %s)',
+ async (locked) => {
+ const setter = jest.fn();
+ const { rerenderMenu } = renderMenu(
+ ,
+ );
+ const button = screen.getByTestId(locked ? 'code-workspace-locked-status' : 'code-workspace');
+ expect(button).toHaveAttribute('aria-disabled', 'true');
+ await userEvent.tab();
+ expect(button).toHaveFocus();
+
+ for (const state of ['loading', 'unavailable', 'missing'] as const) {
+ const pending = workspace({
+ locked,
+ state,
+ canSubmit: false,
+ environments: [
+ {
+ environment,
+ state,
+ workspaces: [],
+ requiredBy: [{ id: 'reviewer', name: 'PR Reviewer' }],
+ },
+ ],
+ });
+ rerenderMenu();
+ expect(await screen.findByRole('tooltip')).toHaveTextContent('PR Reviewer');
+ expect(screen.getByRole('tooltip')).toHaveTextContent(`com_ui_code_workspace_${state}`);
+ expect(button).toHaveFocus();
+ await userEvent.keyboard('{Enter}{ArrowDown} ');
+ await userEvent.click(button);
+ expect(screen.queryByRole('menu')).not.toBeInTheDocument();
+ }
+ expect(setter).not.toHaveBeenCalled();
+ },
+ );
+
+ test('keeps locked recovery guidance alongside checkout metadata without agent requirements', async () => {
+ const graph = workspace({ locked: true, state: 'unsupported', canSubmit: false });
+ graph.environments[0].state = 'unsupported';
+ graph.environments[0].selected!.checkout = 'isolated';
+ renderMenu();
+ await userEvent.tab();
+ const tooltip = await screen.findByRole('tooltip');
+ expect(tooltip).toHaveTextContent('com_ui_code_workspace_locked_recovery');
+ expect(tooltip).toHaveTextContent('Personal VM · Project A · com_ui_code_checkout_isolated');
+ });
+
+ test('keeps requirements in a disabled transition tooltip', async () => {
+ const graph = workspace({ locked: true, state: 'unavailable', canSubmit: false });
+ graph.environments[0].state = 'unavailable';
+ graph.environments[0].requiredBy = [{ id: 'reviewer', name: 'PR Reviewer' }];
+ graph.transition = {
+ kind: 'detach',
+ conversationId: 'chat-1',
+ from: graph.selections!,
+ previous: [],
+ retained: [],
+ targets: [],
+ detachable: true,
+ };
+ renderMenu();
+ await userEvent.tab();
+ const tooltip = await screen.findByRole('tooltip');
+ expect(tooltip).toHaveTextContent('com_ui_code_workspace_detach_info');
+ expect(tooltip).toHaveTextContent(
+ 'PR Reviewer needs Personal VM: com_ui_code_workspace_unavailable',
+ );
+ });
+
test('shows pending workspace requirements in the menu without a second live region', async () => {
const graph = workspace({ state: 'loading', canSubmit: false });
graph.environments[0] = {
@@ -1689,11 +1760,13 @@ describe('CodeWorkspaceMenu', () => {
await userEvent.click(
await screen.findByRole('menuitem', { name: 'com_ui_code_workspace_recover' }),
);
- await waitFor(() => expect(screen.getByTestId('code-workspace-move')).toBeDisabled());
+ await waitFor(() =>
+ expect(screen.getByTestId('code-workspace-move')).toHaveAttribute('aria-disabled', 'true'),
+ );
expect(setConversation).not.toHaveBeenCalled();
finish?.();
await waitFor(() => expect(setConversation).toHaveBeenCalledTimes(1));
- expect(screen.getByTestId('code-workspace-move')).not.toBeDisabled();
+ expect(screen.getByTestId('code-workspace-move')).not.toHaveAttribute('aria-disabled');
});
test('prevents confirmation if a generation starts while the recovery menu is open', async () => {