Skip to content

Commit 46be47d

Browse files
committed
stop select dialog event propagation
1 parent 4af9def commit 46be47d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,26 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
157157

158158
const keybind = useKeybind()
159159
useKeyboard((evt) => {
160-
if (evt.name === "up" || (evt.ctrl && evt.name === "p")) move(-1)
161-
if (evt.name === "down" || (evt.ctrl && evt.name === "n")) move(1)
162-
if (evt.name === "pageup") move(-10)
163-
if (evt.name === "pagedown") move(10)
160+
if (evt.name === "up" || (evt.ctrl && evt.name === "p")) {
161+
evt.preventDefault()
162+
evt.stopPropagation()
163+
move(-1)
164+
}
165+
if (evt.name === "down" || (evt.ctrl && evt.name === "n")) {
166+
evt.preventDefault()
167+
evt.stopPropagation()
168+
move(1)
169+
}
170+
if (evt.name === "pageup") {
171+
evt.preventDefault()
172+
evt.stopPropagation()
173+
move(-10)
174+
}
175+
if (evt.name === "pagedown") {
176+
evt.preventDefault()
177+
evt.stopPropagation()
178+
move(10)
179+
}
164180
if (evt.name === "return") {
165181
const option = selected()
166182
if (option) {

0 commit comments

Comments
 (0)