diff --git a/src/renderer/src/components/new-workspace/RunTargetCombobox.test.tsx b/src/renderer/src/components/new-workspace/RunTargetCombobox.test.tsx
index 48e3ce297f6..f051da8bdda 100644
--- a/src/renderer/src/components/new-workspace/RunTargetCombobox.test.tsx
+++ b/src/renderer/src/components/new-workspace/RunTargetCombobox.test.tsx
@@ -271,4 +271,66 @@ describe('RunTargetCombobox', () => {
press('Home')
expect(activeText()).toContain('Local Mac')
})
+
+ it('tells screen readers what Enter does on rows whose action is not a Tab stop, and Enter does it', () => {
+ const needsSetup = (name: string, connect: boolean): ProjectHostSetupOption => ({
+ id: `needs-setup:ssh:${name}`,
+ kind: 'needs-setup',
+ projectId: 'p',
+ hostId: `ssh:${name}`,
+ label: name,
+ detail: 'Project location not set',
+ isAvailable: true,
+ attention: connect,
+ canSetLocation: true,
+ ...(connect ? { connectAction: { kind: 'ssh' as const, targetId: name } } : {})
+ })
+ const onConnectHost = vi.fn()
+ const onSetLocation = vi.fn()
+ act(() => {
+ root.render(
+
+ {}}
+ onAddRemoteServer={vi.fn()}
+ onConnectHost={onConnectHost}
+ onSetLocation={onSetLocation}
+ orcaCloudAccess={{ state: 'signed-out' }}
+ />
+
+ )
+ })
+ act(() => {
+ input().focus()
+ input().click()
+ })
+ const description = (label: string): string | null | undefined => {
+ const row = [...container.querySelectorAll('[role="option"]')].find((option) =>
+ option.textContent?.startsWith(label)
+ )
+ const id = row?.getAttribute('aria-describedby')
+ return id ? document.getElementById(id)?.textContent : null
+ }
+ expect(description('devbox')).toBe('devbox, project location not set. Press Enter to set it.')
+ expect(description('gpu-box')).toBe('gpu-box, not connected. Press Enter to connect.')
+ expect(description('Orca Cloud')).toBe('Orca Cloud, signed out. Press Enter to sign in.')
+ // A ready host needs no hint: Enter just picks it.
+ expect(description('Local Mac')).toBeNull()
+
+ // Enter on the Connect row connects (it used to fall through to Set location).
+ for (let i = 0; i < 8 && !activeText()?.startsWith('gpu-box'); i++) {
+ press('ArrowDown')
+ }
+ expect(activeText()).toMatch(/^gpu-box/)
+ press('Enter')
+ expect(onConnectHost).toHaveBeenCalledWith(expect.objectContaining({ label: 'gpu-box' }))
+ expect(onSetLocation).not.toHaveBeenCalled()
+ })
})
diff --git a/src/renderer/src/components/new-workspace/RunTargetCombobox.tsx b/src/renderer/src/components/new-workspace/RunTargetCombobox.tsx
index 0a9b17ee483..b07abf4670e 100644
--- a/src/renderer/src/components/new-workspace/RunTargetCombobox.tsx
+++ b/src/renderer/src/components/new-workspace/RunTargetCombobox.tsx
@@ -247,7 +247,12 @@ export default function RunTargetCombobox({
return
}
if (row.kind === 'needs-setup') {
- setLocation(row.option)
+ // Enter does what the row's inline action does: Connect is not a Tab stop of its own.
+ if (row.option.connectAction && onConnectHost) {
+ void connectHost(row.option)
+ } else {
+ setLocation(row.option)
+ }
return
}
if (row.kind === 'orca-cloud') {
@@ -257,7 +262,7 @@ export default function RunTargetCombobox({
// Keyboard opening moves the arm into the submenu so arrows and Enter reach its rows.
openSubmenu(row.kind === 'recipes' ? 'recipes' : 'add-host', true)
},
- [openSubmenu, rows, selectHost, selectOrcaCloud, setLocation]
+ [connectHost, onConnectHost, openSubmenu, rows, selectHost, selectOrcaCloud, setLocation]
)
const inSubmenu = submenu !== null && armedItemKey !== null
diff --git a/src/renderer/src/components/new-workspace/RunTargetComboboxRow.tsx b/src/renderer/src/components/new-workspace/RunTargetComboboxRow.tsx
index a90e6a92dd3..bf9ba913cf9 100644
--- a/src/renderer/src/components/new-workspace/RunTargetComboboxRow.tsx
+++ b/src/renderer/src/components/new-workspace/RunTargetComboboxRow.tsx
@@ -25,7 +25,8 @@ export function RunTargetRow({
busy = false,
onArm,
onCommit,
- trailing
+ trailing,
+ description
}: {
icon: React.ReactNode
label: string
@@ -53,6 +54,8 @@ export function RunTargetRow({
busy?: boolean
/** Keyboard focus moved into this row's submenu: keep a lighter fill so the path stays visible. */
armedInSubmenu?: boolean
+ /** What Enter does when the row's inline action isn't a Tab stop of its own. */
+ description?: string
}): React.JSX.Element {
const t = useTranslate()
const hasDetail = Boolean(detailNode ?? detail)
@@ -65,6 +68,7 @@ export function RunTargetRow({
aria-busy={busy || undefined}
// option supports aria-haspopup but not aria-expanded; submenus are listboxes.
aria-haspopup={submenu ? 'listbox' : undefined}
+ aria-describedby={description ? `${optionId}-hint` : undefined}
data-armed={armed || undefined}
data-current={current ? 'true' : undefined}
onMouseDown={(event) => event.preventDefault()}
@@ -123,6 +127,11 @@ export function RunTargetRow({
>
)}
{trailing}
+ {description ? (
+
+ {description}
+
+ ) : null}
{/* The committed row gets a check, not a second fill, so only the armed row is shaded. */}
{current ? (
diff --git a/src/renderer/src/components/new-workspace/RunTargetOrcaCloudRow.tsx b/src/renderer/src/components/new-workspace/RunTargetOrcaCloudRow.tsx
index 01f65e8ce0b..c3f574b3f7e 100644
--- a/src/renderer/src/components/new-workspace/RunTargetOrcaCloudRow.tsx
+++ b/src/renderer/src/components/new-workspace/RunTargetOrcaCloudRow.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+import { orcaCloudRowHint } from './run-target-row-hints'
import { Cloud } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { buttonVariants } from '@/components/ui/button'
@@ -318,6 +319,7 @@ export function RunTargetOrcaCloudRow({
busy={pending}
onArm={onArm}
onCommit={onSelect}
+ description={orcaCloudRowHint(access, t)}
trailing={}
/>
)
diff --git a/src/renderer/src/components/new-workspace/RunTargetRowList.tsx b/src/renderer/src/components/new-workspace/RunTargetRowList.tsx
index 163f4bf4bc8..89fe146ff91 100644
--- a/src/renderer/src/components/new-workspace/RunTargetRowList.tsx
+++ b/src/renderer/src/components/new-workspace/RunTargetRowList.tsx
@@ -7,6 +7,8 @@ import { HostRowIcon, RunTargetRow } from './RunTargetComboboxRow'
import { ConnectHostButton, NeedsSetupHostIcon, SetLocationButton } from './RunTargetRowActions'
import { RecipesSubmenuRow, type RunTargetSubmenuArm } from './RunTargetSubmenus'
import { RunTargetOrcaCloudRow } from './RunTargetOrcaCloudRow'
+import { needsSetupRowHint } from './run-target-row-hints'
+import { useTranslate } from '@/i18n/use-translate'
import type { OrcaCloudRunTargetAccess } from './orca-cloud-run-target-access'
import type { EphemeralVmRecipeOption, RunTargetRowModel } from './run-target-options'
@@ -62,6 +64,7 @@ export default function RunTargetRowList({
onConnectHost: (option: NeedsSetupProjectHostOption) => void
onSetLocation: (option: NeedsSetupProjectHostOption) => void
}): React.JSX.Element {
+ const t = useTranslate()
return (
<>
{rows.map((row) => {
@@ -124,6 +127,11 @@ export default function RunTargetRowList({
optionId={optionId}
onArm={() => onArm(row.key, null)}
onCommit={() => onSetLocation(row.option)}
+ description={needsSetupRowHint(
+ row.option,
+ { connect: canConnect, setLocation: canSetLocation, connecting },
+ t
+ )}
trailing={
hasConnect ? (
,
+ can: { connect: boolean; setLocation: boolean; connecting: boolean },
+ t: Translate
+): string | undefined {
+ if (can.connecting) {
+ return undefined
+ }
+ if (option.connectAction && can.connect) {
+ return t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintConnect',
+ '{{host}}, not connected. Press Enter to connect.',
+ { host: option.label }
+ )
+ }
+ if (option.canSetLocation && can.setLocation) {
+ return t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintSetLocation',
+ '{{host}}, project location not set. Press Enter to set it.',
+ { host: option.label }
+ )
+ }
+ return undefined
+}
+
+/** Orca Cloud when picking it runs a fix first (sign in, plan, overage, payment). */
+export function orcaCloudRowHint(
+ access: OrcaCloudRunTargetAccess,
+ t: Translate
+): string | undefined {
+ switch (access.state) {
+ case 'signed-out':
+ return t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintSignIn',
+ 'Orca Cloud, signed out. Press Enter to sign in.'
+ )
+ case 'no-plan':
+ if (!access.canManageBilling) {
+ return undefined
+ }
+ return access.lapsed
+ ? t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintRenew',
+ 'Orca Cloud, your Team plan ended. Press Enter to renew it.'
+ )
+ : t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintChoosePlan',
+ 'Orca Cloud needs a Team plan. Press Enter to choose one.'
+ )
+ case 'out-of-hours':
+ if (!access.canManageBilling) {
+ return undefined
+ }
+ return access.cause === 'cap'
+ ? t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintRaiseCap',
+ 'Orca Cloud, spend cap reached. Press Enter to raise it.'
+ )
+ : t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintTurnOnOverage',
+ 'Orca Cloud, sandbox hours used up. Press Enter to turn on overage.'
+ )
+ case 'payment-issue':
+ return access.canManageBilling
+ ? t(
+ 'auto.components.new.workspace.RunTargetCombobox.hintUpdatePayment',
+ 'Orca Cloud, payment failed. Press Enter to update your payment method.'
+ )
+ : undefined
+ case 'loading':
+ case 'unknown':
+ case 'entitled':
+ return undefined
+ }
+}
diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json
index 32dbb47cb28..ca8db0cd12b 100644
--- a/src/renderer/src/i18n/locales/en.json
+++ b/src/renderer/src/i18n/locales/en.json
@@ -16710,7 +16710,15 @@
"orcaCloudIdleSleep_other": "Sleeps after {{count}} minutes idle",
"orcaCloudAskAddHoursOnly": "Ask an owner or admin to add hours.",
"orcaCloudAskChoosePlan": "Ask an owner or admin to choose one.",
- "orcaCloudAskRaiseSpendCap": "Ask an owner or admin to raise the spend cap."
+ "orcaCloudAskRaiseSpendCap": "Ask an owner or admin to raise the spend cap.",
+ "hintConnect": "{{host}}, not connected. Press Enter to connect.",
+ "hintSetLocation": "{{host}}, project location not set. Press Enter to set it.",
+ "hintSignIn": "Orca Cloud, signed out. Press Enter to sign in.",
+ "hintRenew": "Orca Cloud, your Team plan ended. Press Enter to renew it.",
+ "hintChoosePlan": "Orca Cloud needs a Team plan. Press Enter to choose one.",
+ "hintRaiseCap": "Orca Cloud, spend cap reached. Press Enter to raise it.",
+ "hintTurnOnOverage": "Orca Cloud, sandbox hours used up. Press Enter to turn on overage.",
+ "hintUpdatePayment": "Orca Cloud, payment failed. Press Enter to update your payment method."
},
"projectCombobox": {
"recentHeading": "Recent",