Click on QField triggers click on nested QBtn #16589
Labels
area/components
bug/1-repro-available
A reproduction is available and needs to be confirmed.
flavour/quasar-cli-vite
kind/bug 🐞
Qv2 🔝
Quasar v2 issues
What happened?
When using a QBtn in a slot of a QField, the QBtn's click handler is triggered when clicking anywhere on the QField. Additionally, the QBtn is highlighted as hovered when hovering the QField.
I think the click and the highlighting comes from the focus helper: https://github.com/quasarframework/quasar/blob/dev/ui/src/composables/private/use-field.js#L275
It searches for an element with a
tabindex
attribute and calls it's focus method. It finds the first button, focuses it and with this forwards the click event to it.What did you expect to happen?
The QBtn's click handler should only be triggered when the QBtn is clicked directly. A click on the QField should only focus the inner content and not trigger the QBtn.
Reproduction URL
https://jsfiddle.net/xg9tprL1/9/
How to reproduce?
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Components (quasar)
Platforms/Browsers
Firefox, Chrome, Safari, Microsoft Edge
Quasar info output
Relevant log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: