Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🦯 fix: Preserve Keyboard Access to BYOM Diagnostics

Liad9ec51ba477b
diff --git a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
index 5d35adefb1..55be91068e 100644
--- a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
+++ b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx
@@ -692,12 +692,15 @@ export default function CodeWorkspaceMenu({
)}
<div className="flex min-w-0 items-center">
<TooltipAnchor
- description={description || recovery}
+ description={
+ requirements.length > 0 ? description : [recovery, ...checkoutSummaries].join(' ')
+ }
render={
- <button
+ <Ariakit.Button
type="button"
data-testid="code-workspace-locked-status"
disabled={disabled || isRefreshing}
+ accessibleWhenDisabled={true}
onClick={() => void refresh()}
aria-label={`${label}. ${recovery}. ${localize('com_ui_retry')}`}
aria-describedby={requirements.length > 0 ? requirementsId : undefined}
@@ -820,10 +823,14 @@ export default function CodeWorkspaceMenu({
<Ariakit.MenuProvider store={menuStore}>
<div className="flex min-w-0 items-center">
<TooltipAnchor
- description={transitionText?.info ?? (description || localize('com_ui_code_workspace'))}
+ description={
+ [transitionText?.info, description].filter(Boolean).join(' ') ||
+ localize('com_ui_code_workspace')
+ }
render={
<Ariakit.MenuButton
disabled={buttonDisabled}
+ accessibleWhenDisabled={true}
onClick={() => 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(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={true} />);
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(
+ <CodeWorkspaceMenu setConversation={setter} workspace={workspace({ locked })} disabled />,
+ );
+ 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(<CodeWorkspaceMenu setConversation={setter} workspace={pending} disabled />);
+ 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(<CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled />);
+ 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(<CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled />);
+ 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 () => {