简体   繁体   中英

Disable Quasar slider arrow key events

When doing a slider input the arrow keys are bound to that slider, even after the mouse event is finished. Using arrowLeft/arrowRight steps the q-slider one value and stops the key event. I'm using the arrow keys for something else in my application ( document.addEventListener("onkeydown",(e: Event)=>{//...} ) and want to disable this behavior. On normal HTML sliders, I can do <input type="range" onkeydown="event.preventDefault();return true;" /> to disable this, but this does not work on the Quasar sliders.

Solved it by capturing all key events on the document.

    document.addEventListener("keydown", (e: KeyboardEvent) => {
        doButtonPress(e)
    }, true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM