Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions packages/app/e2e/prompt/prompt-footer-focus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ async function body(prompt: Locator) {
return prompt.evaluate((el) => (el as HTMLElement).innerText)
}

async function hitTest(locator: Locator) {
return locator.evaluate((el) => {
const rect = el.getBoundingClientRect()
const x = rect.left + rect.width / 2
const y = rect.top + rect.height / 2
const hit = document.elementFromPoint(x, y)
const action = hit instanceof Element ? hit.closest("[data-action]")?.getAttribute("data-action") : null
return {
within: hit === el || !!hit && el.contains(hit),
action,
tag: hit?.tagName ?? null,
}
})
}

test("agent select returns focus to the prompt", async ({ page, gotoSession }) => {
await gotoSession()

Expand Down Expand Up @@ -86,3 +101,19 @@ test("model select returns focus to the prompt", async ({ page, gotoSession }) =
await prompt.pressSequentially(" model")
await expect.poll(() => body(prompt)).toContain("focus model")
})

test("home model selector opens without footer overlap", async ({ page, gotoSession }) => {
await gotoSession()

const trigger = page.locator(`${promptModelSelector} [data-action="prompt-model"]`).first()
await expect(trigger).toBeVisible()
const hit = await hitTest(trigger)

Comment thread
coderabbitai[bot] marked this conversation as resolved.
expect(hit.within, `model trigger center was intercepted by ${hit.tag ?? "unknown"} (${hit.action ?? "no-action"})`).toBe(
true,
)

await trigger.click()

await expect(page.locator('[data-slot="list-item"]').first()).toBeVisible()
})
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/app",
"version": "0.2.8",
"version": "0.2.9",
"description": "",
"type": "module",
"exports": {
Expand Down
183 changes: 118 additions & 65 deletions packages/app/src/components/prompt-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1514,75 +1514,128 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
}}
/>

<div class="pointer-events-none absolute bottom-2 right-2 flex items-center gap-2">
<input
ref={fileInputRef}
type="file"
multiple
accept={ACCEPTED_FILE_TYPES.join(",")}
class="hidden"
onChange={(e) => {
const list = e.currentTarget.files
if (list) void addAttachments(Array.from(list))
e.currentTarget.value = ""
}}
/>

<Show when={props.homeMode && store.mode === "normal"}>
<div class="flex items-center gap-1.5 pointer-events-auto">
{renderModelControl(buttons)}
{renderVariantControl(buttons)}
</div>
</Show>
<div class="flex items-center gap-1 pointer-events-auto">
<Tooltip placement="top" inactive={!working() && blank()} value={tip()}>
<IconButton
data-action="prompt-submit"
type="submit"
disabled={store.mode !== "normal" || (!working() && blank() && !props.selectedSkill?.())}
tabIndex={store.mode === "normal" ? undefined : -1}
icon={stopping() ? "stop" : "arrow-up"}
variant="primary"
class="size-8"
style={buttons()}
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
/>
</Tooltip>
</div>
</div>
<input
ref={fileInputRef}
type="file"
multiple
accept={ACCEPTED_FILE_TYPES.join(",")}
class="hidden"
onChange={(e) => {
const list = e.currentTarget.files
if (list) void addAttachments(Array.from(list))
e.currentTarget.value = ""
}}
/>

<div class="pointer-events-none absolute bottom-2 left-2">
<div
aria-hidden={store.mode !== "normal"}
class="pointer-events-auto flex items-center gap-2"
style={{
"pointer-events": buttonsSpring() > 0.5 ? "auto" : "none",
}}
>
<Show when={props.homeMode}>
<WorkspaceChip />
</Show>
<TooltipKeybind
placement="top"
title={language.t("prompt.action.attachFile")}
keybind={command.keybind("file.attach")}
<Show
when={props.homeMode}
fallback={
<>
<div class="pointer-events-none absolute bottom-2 right-2 flex items-center gap-2">
<div class="flex items-center gap-1 pointer-events-auto">
<Tooltip placement="top" inactive={!working() && blank()} value={tip()}>
<IconButton
data-action="prompt-submit"
type="submit"
disabled={store.mode !== "normal" || (!working() && blank() && !props.selectedSkill?.())}
tabIndex={store.mode === "normal" ? undefined : -1}
icon={stopping() ? "stop" : "arrow-up"}
variant="primary"
class="size-8"
style={buttons()}
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
/>
</Tooltip>
</div>
</div>

<div class="pointer-events-none absolute bottom-2 left-2">
<div
aria-hidden={store.mode !== "normal"}
class="pointer-events-auto flex items-center gap-2"
style={{
"pointer-events": buttonsSpring() > 0.5 ? "auto" : "none",
}}
>
<TooltipKeybind
placement="top"
title={language.t("prompt.action.attachFile")}
keybind={command.keybind("file.attach")}
>
<Button
data-action="prompt-attach"
type="button"
variant="ghost"
class="size-8 p-0"
style={buttons()}
onClick={pick}
disabled={store.mode !== "normal"}
tabIndex={store.mode === "normal" ? undefined : -1}
aria-label={language.t("prompt.action.attachFile")}
>
<Icon name="plus" class="size-4.5" />
</Button>
</TooltipKeybind>
</div>
</div>
</>
}
>
<div class="pointer-events-none absolute inset-x-2 bottom-2 flex items-center justify-between gap-2">
<div
aria-hidden={store.mode !== "normal"}
class="pointer-events-auto flex min-w-0 items-center gap-2"
style={{
"pointer-events": buttonsSpring() > 0.5 ? "auto" : "none",
}}
>
<Button
data-action="prompt-attach"
type="button"
variant="ghost"
class="size-8 p-0"
style={buttons()}
onClick={pick}
disabled={store.mode !== "normal"}
tabIndex={store.mode === "normal" ? undefined : -1}
aria-label={language.t("prompt.action.attachFile")}
<WorkspaceChip />
<TooltipKeybind
placement="top"
title={language.t("prompt.action.attachFile")}
keybind={command.keybind("file.attach")}
>
<Icon name="plus" class="size-4.5" />
</Button>
</TooltipKeybind>
<Button
data-action="prompt-attach"
type="button"
variant="ghost"
class="size-8 shrink-0 p-0"
style={buttons()}
onClick={pick}
disabled={store.mode !== "normal"}
tabIndex={store.mode === "normal" ? undefined : -1}
aria-label={language.t("prompt.action.attachFile")}
>
<Icon name="plus" class="size-4.5" />
</Button>
</TooltipKeybind>
</div>

<div class="flex min-w-0 items-center justify-end gap-2">
<Show when={store.mode === "normal"}>
<div class="flex min-w-0 items-center gap-1.5 pointer-events-auto">
{renderModelControl(buttons)}
{renderVariantControl(buttons)}
</div>
</Show>
<div class="flex items-center gap-1 pointer-events-auto">
<Tooltip placement="top" inactive={!working() && blank()} value={tip()}>
<IconButton
data-action="prompt-submit"
type="submit"
disabled={store.mode !== "normal" || (!working() && blank() && !props.selectedSkill?.())}
tabIndex={store.mode === "normal" ? undefined : -1}
icon={stopping() ? "stop" : "arrow-up"}
variant="primary"
class="size-8"
style={buttons()}
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
/>
</Tooltip>
</div>
</div>
</div>
</div>
</Show>
Comment thread
Astro-Han marked this conversation as resolved.
</div>
</DockShellForm>
<Show when={!props.homeMode && (store.mode === "normal" || store.mode === "shell")}>
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/desktop-electron",
"private": true,
"version": "0.2.8",
"version": "0.2.9",
"type": "module",
"license": "Apache-2.0",
"homepage": "https://pawwork.ai",
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.2.8",
"version": "0.2.9",
"name": "opencode",
"type": "module",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/util",
"version": "0.2.8",
"version": "0.2.9",
"private": true,
"type": "module",
"license": "Apache-2.0",
Expand Down
Loading