Do not work 'autofocus' property of QInput in Dialog.
Hi. Quasar v0.17.15. https://jsfiddle.net/x6qg4a23/38/ QInput field with 'autofocus' property has no focus.
Hi,
autofocus property focuses the field on first render. When used on a Modal and you click to show the Modal, it's already rendered. So call .focus() on it after Modal is shown.
Thank you for answer, but call .focus() in @show event of Dialog do not work too. New example here: https://jsfiddle.net/sontis3/x6qg4a23/47/ Focused field is flashed, but has no focus. What are I do wrong?
Hi. On show, QDialog does the following:
- emit
show - if it has prompt or options it focuses the controls
- else it focuses the last button
So when you catch @show and try to focus your field you are before steps 2 and 3, and after you focus you lose focus for the button.
The solution is to focus with a timeout:
onShow() {
this.$nextTick(() => this.$refs.ff1.focus())
},
full sample here: https://jsfiddle.net/9xk43810/