pdanpdan/quasar

Bug - QDialog autofocusing on first QInput even if `autofocus` prop isn't defined

nicholaszuccarelli opened this issue · 3 comments

(Thank you for fixing all the other bugs - my app is running really well now. Super happy!!)

https://github.com/nicholaszuccarelli/android-cordova-bugs-nov2021

Happening on all platforms.
In the example below, opening a QDialog is autofocusing on the first element which is found in the dialog.
This behaviour is correct for QBtn components, but I don't think it should be applied to the first QInput it can find - it should only apply if the autofocus prop is specified.

Screen_Recording_20211202-100101_Quasar.App.mp4

This is by design:

  • if the diload does not have no-focus prop it tries to focus
  • it searches for an element to focus on in this order:
    • any element with autofocus or data-autofocus attr
    • any focusable element

So in your case just put the autofocus attr on a button or some other element in the dialog.

I'll check if it's written in the docs somewhere, and if not I'll add it (it's not :) ).

No worries, thanks for that. Will change my app around a bit then.

Added section in the docs for QDialog about selecting focused element