Quasar: @keyup.enter propogates through q-dialogs

Created on 2 Aug 2019  路  3Comments  路  Source: quasarframework/quasar

Describe the bug
setup:
a q-input with @keydown.enter event that closes a q-dialog its in (via plugin component)
when the event is fired the q-dialog gets closed, but the @enter propogates to the q-btn which was used to open that dialog.

It is because the q-btn is firing a @click event when it has focus and detects @keydown.enter (or keyup?)

Codepen/jsFiddle/Codesandbox (required)
https://codepen.io/mesqueeb/pen/aeyqoL

Expected behavior
the keydown/up event to not propogate

GIF
2019-08-02 14 50 25

bug

Most helpful comment

Because the buttons listen for keyup to trigger. If you close the dialog on keydown the button would receive focus and react on keyup.

All 3 comments

You just placed the hide call in the wrong event - it should go in @keyup
https://codepen.io/anon/pen/MNvzMx?editors=0010

@pdanpdan thanks!!! It works when I use keyup instead.
Do you know why?

Because the buttons listen for keyup to trigger. If you close the dialog on keydown the button would receive focus and react on keyup.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

green-mike picture green-mike  路  3Comments

fnicollier picture fnicollier  路  3Comments

victorborgaco picture victorborgaco  路  3Comments

danikane picture danikane  路  3Comments

nueko picture nueko  路  3Comments