diff --git a/packages/app/component-tests/session-question-dock.spec.ts b/packages/app/component-tests/session-question-dock.spec.ts
index f2df5f7cb25..a9bd0538125 100644
--- a/packages/app/component-tests/session-question-dock.spec.ts
+++ b/packages/app/component-tests/session-question-dock.spec.ts
@@ -2,6 +2,70 @@ import type { Locator } from "@playwright/test"
import type { MotionKnob } from "@opencode/ui/motion-tuning"
import { expect, sourceURL, story } from "../../stories/playwright/story"
+for (const variant of ["classic", "experimental"] as const) {
+ story(`${variant} answer cards allow text selection without changing answers`, async ({ mount, page }) => {
+ await page.addInitScript(
+ (enabled) => localStorage.setItem("settings.v3", JSON.stringify({ general: { newQuestionUI: enabled } })),
+ variant === "experimental",
+ )
+
+ const component = await mount("app-current-session-surface--question-request")
+
+ const question = component.locator('[data-component="dock-prompt"][data-kind="question"]')
+
+ const wide = question.getByRole("radio", { name: /Wide/ })
+
+ await expect(question.getByRole("radio", { name: /Focused/ })).toBeFocused()
+ await page.evaluate(() => document.fonts.ready.then(() => undefined))
+
+ const drag = async (text: Locator) => {
+ await text.scrollIntoViewIfNeeded()
+
+ const box = await text.boundingBox()
+
+ expect(box).not.toBeNull()
+ await page.mouse.move(box!.x + 1, box!.y + box!.height / 2)
+ await page.mouse.down()
+ await page.mouse.move(box!.x + box!.width - 1, box!.y + box!.height / 2, { steps: 12 })
+ await page.mouse.up()
+ await expect.poll(() => page.evaluate(() => window.getSelection()?.toString().trim())).toBe(await text.innerText())
+ }
+
+ for (const slot of ["option-label", "option-description"]) {
+ await drag(wide.locator(`[data-slot="${slot}"] bdi`))
+ await expect(wide).not.toBeChecked()
+ }
+
+ await wide.locator('[data-slot="option-description"] bdi').click({ modifiers: ["Shift"] })
+ await expect(wide).not.toBeChecked()
+ await wide.click({ position: { x: 4, y: 4 } })
+ await expect(wide).toBeChecked()
+ await question.getByRole("radio", { name: /Focused/ }).click()
+ await drag(wide.locator('[data-slot="option-description"] bdi'))
+ await expect(wide).not.toBeChecked()
+
+ const mark = await wide.locator('[data-slot="question-option-check"]').boundingBox()
+
+ expect(mark).not.toBeNull()
+ await page.mouse.move(mark!.x + mark!.width / 2, mark!.y + mark!.height / 2)
+ await page.mouse.down()
+ await page.mouse.move(mark!.x + mark!.width / 2 + 1, mark!.y + mark!.height / 2)
+ await page.mouse.up()
+ await expect(wide).toBeChecked()
+ await question.getByRole("button", { name: "Next", exact: true }).click()
+
+ const files = question.getByRole("checkbox", { name: "Changed files", exact: true })
+
+ await expect(files).toBeFocused()
+ await files.click()
+ await expect(files).toBeChecked()
+ await drag(files.locator('[data-slot="option-label"] bdi'))
+ await expect(files).toBeChecked()
+ await files.click({ position: { x: 4, y: 4 } })
+ await expect(files).not.toBeChecked()
+ })
+}
+
story(
"uses the original question cards by default and submits selected and custom answers",
async ({ mount, page }) => {
@@ -32,7 +96,9 @@ story(
const submit = question.getByRole("button", { name: "Submit", exact: true })
expect(await submit.evaluate((button) => button.getBoundingClientRect().width)).toBe(width)
await expect(shortcuts).toHaveText(["1", "2", "3", "4"])
- await files.click()
+ await page.keyboard.down(" ")
+ await page.keyboard.down(" ")
+ await page.keyboard.up(" ")
await terminal.click()
await expect(files).toBeChecked()
await expect(terminal).toBeChecked()
diff --git a/packages/app/src/session/requests/session-question-dock-classic.tsx b/packages/app/src/session/requests/session-question-dock-classic.tsx
index 5d5dedb0590..4d90c980c5e 100644
--- a/packages/app/src/session/requests/session-question-dock-classic.tsx
+++ b/packages/app/src/session/requests/session-question-dock-classic.tsx
@@ -47,22 +47,57 @@ function Option(props: {
description?: string
number: number
disabled: boolean
- ref?: (el: HTMLButtonElement) => void
+ ref?: (el: HTMLDivElement) => void
onFocus?: VoidFunction
onClick: VoidFunction
}) {
+ let pointer: { x: number; y: number } | undefined
+
return (
-
+
)
}
@@ -126,7 +161,7 @@ export const SessionQuestionDockClassic: Component<{ request: FormInfo; onSubmit
let optionsRef: HTMLDivElement | undefined
let customRef: HTMLButtonElement | undefined
let customInput: HTMLInputElement | undefined
- let optsRef: HTMLButtonElement[] = []
+ let optsRef: HTMLDivElement[] = []
let replied = false
let focusFrame: number | undefined
diff --git a/packages/app/src/session/requests/session-question-dock-experimental.tsx b/packages/app/src/session/requests/session-question-dock-experimental.tsx
index 42add84d42e..7949c6873a9 100644
--- a/packages/app/src/session/requests/session-question-dock-experimental.tsx
+++ b/packages/app/src/session/requests/session-question-dock-experimental.tsx
@@ -194,23 +194,47 @@ function Option(props: {
shortcut?: string
disabled: boolean
tabbable: boolean
- ref?: (el: HTMLButtonElement) => void
+ ref?: (el: HTMLDivElement) => void
onFocus?: VoidFunction
onClick: VoidFunction
}) {
+ let pointer: { x: number; y: number } | undefined
+
return (
-
+
)
}
@@ -270,7 +294,7 @@ export const SessionQuestionDockExperimental: Component<{ request: FormInfo; onS
let customRow: HTMLDivElement | undefined
let highlightRef: HTMLSpanElement | undefined
let customInput: HTMLInputElement | undefined
- let optsRef: HTMLButtonElement[] = []
+ let optsRef: HTMLDivElement[] = []
let replied = false
const question = createMemo(() => questions()[store.tab])
diff --git a/packages/session-ui/src/components/question-prompt-experimental.css b/packages/session-ui/src/components/question-prompt-experimental.css
index c2fe574baec..a4dd987b465 100644
--- a/packages/session-ui/src/components/question-prompt-experimental.css
+++ b/packages/session-ui/src/components/question-prompt-experimental.css
@@ -303,6 +303,8 @@
}
[data-slot="question-option-check"] {
+ -webkit-user-select: none;
+ user-select: none;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -358,6 +360,8 @@
}
[data-slot="question-option-main"] {
+ -webkit-user-select: text;
+ user-select: text;
display: flex;
flex-direction: column;
gap: 4px;
diff --git a/packages/session-ui/src/components/question-prompt.css b/packages/session-ui/src/components/question-prompt.css
index 1762cb73c35..e66df395079 100644
--- a/packages/session-ui/src/components/question-prompt.css
+++ b/packages/session-ui/src/components/question-prompt.css
@@ -246,6 +246,8 @@
}
[data-slot="question-option-check"] {
+ -webkit-user-select: none;
+ user-select: none;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -308,6 +310,8 @@
}
[data-slot="question-option-main"] {
+ -webkit-user-select: text;
+ user-select: text;
display: flex;
flex-direction: column;
gap: 6px;
@@ -316,6 +320,8 @@
}
[data-slot="question-option-shortcut"] {
+ -webkit-user-select: none;
+ user-select: none;
--keybind-font-size: 10px;
--keybind-font-weight: var(--font-weight-regular);
--keybind-transition-duration: var(--question-feedback-duration);
@@ -337,7 +343,7 @@
[data-slot="option-description"] {
min-inline-size: 0;
font-family: var(--v2-font-family-sans);
- font-size: 11px;
+ font-size: 12px;
font-weight: 440;
line-height: var(--line-height-tight);
letter-spacing: 0.05px;