quasar icon indicating copy to clipboard operation
quasar copied to clipboard

autofocus doesn't work for q-input in q-dialog

Open llin55 opened this issue 8 years ago • 3 comments

Software version

Quasar: 0.15.10 OS: Node: NPM: Browsers: iOS: Android: Any other software related to your bug:

JsFiddle (for Quasar v0.15+ only)

https://jsfiddle.net/upap4Lxy/3/

What did you get as the error?

q-input doesn't get focus when opened in q-dialog

What were you expecting?

What steps did you take, to get the error?

llin55 avatar May 16 '18 11:05 llin55

Hi,

Yes, it is a limitation. But Quasar still allows you to do that: https://jsfiddle.net/u90e7ryg/1/

rstoenescu avatar May 16 '18 11:05 rstoenescu

ok, thanks!

llin55 avatar May 16 '18 14:05 llin55

@rstoenescu Your solution does not work anymore with Quasar v0.17.4 because you are automatically focusing the last button, unless in "prompt" or "options" mode. And because the "show" event is triggered before Quasar force the focus. See https://jsfiddle.net/f5ka4p1u/

It would be nice to have a way to define the focusable element of the dialog. But as a workaround, you can use $nextTick to set the focus of your custom element. @show="$nextTick(() => { $refs.input.focus() })"

chosten avatar Jul 29 '18 14:07 chosten