stop select dialog event propagation
This commit is contained in:
@@ -157,10 +157,26 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
|||||||
|
|
||||||
const keybind = useKeybind()
|
const keybind = useKeybind()
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (evt.name === "up" || (evt.ctrl && evt.name === "p")) move(-1)
|
if (evt.name === "up" || (evt.ctrl && evt.name === "p")) {
|
||||||
if (evt.name === "down" || (evt.ctrl && evt.name === "n")) move(1)
|
evt.preventDefault()
|
||||||
if (evt.name === "pageup") move(-10)
|
evt.stopPropagation()
|
||||||
if (evt.name === "pagedown") move(10)
|
move(-1)
|
||||||
|
}
|
||||||
|
if (evt.name === "down" || (evt.ctrl && evt.name === "n")) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
move(1)
|
||||||
|
}
|
||||||
|
if (evt.name === "pageup") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
move(-10)
|
||||||
|
}
|
||||||
|
if (evt.name === "pagedown") {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
move(10)
|
||||||
|
}
|
||||||
if (evt.name === "return") {
|
if (evt.name === "return") {
|
||||||
const option = selected()
|
const option = selected()
|
||||||
if (option) {
|
if (option) {
|
||||||
|
|||||||
Reference in New Issue
Block a user