禁用类星体滑块箭头密钥事件

发布于 2025-02-09 22:51:00 字数 187 浏览 2 评论 0原文

进行滑块输入时,即使完成鼠标事件后,箭头键也绑定到该滑块。使用arrowleft/arrowright步骤q-slider一个值并停止关键事件。 我正在使用箭头键(document.addeventlistener(“ onkeydown”,(e:event)=> {// ...}),并希望禁用此信息行为。在类星体滑块上。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

硪扪都還晓 2025-02-16 22:51:00

通过捕获文档上的所有关键事件来解决它。

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

Solved it by capturing all key events on the document.

    document.addEventListener("keydown", (e: KeyboardEvent) => {
        doButtonPress(e)
    }, true)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文