copyToClipboard fallback mechanism does not work in dialog #15076
Labels
bug/1-repro-available
A reproduction is available and needs to be confirmed.
flavour/quasar-cli-vite
has-workaround
kind/bug 🐞
mode/spa
Qv2 🔝
Quasar v2 issues
What happened?
When
copyToClipboard
is called in an environment wherenavigator.clipboard
is not available (e.g. over insecure connection) and aQDialog
is up, the text is not copied.What did you expect to happen?
The text should be copied, no matter whether a dialog is or is not active.
Reproduction URL
https://jsfiddle.net/rL4d9aux/3/
How to reproduce?
navigator.clipboard
is available, so the reporeted behaviour would not take place. For that reason I manually copied over the fallback branch of the code.outside dialog
is in the clipboard.inside dialog
should be in the clipboard but is not.Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
SPA Mode
Platforms/Browsers
Firefox, Chrome
Quasar info output
Relevant log output
No response
Additional context
My investigation shows that the cause is that the textarea (used by the fallback mechanism) cannot get focus (is not the
document.activeElement
after thefocus()
call). The selection inside it set up properly.Suggestion for fix
When I switch the order of the
focus()
andselect()
calls, the copy now works even when a dialog is around. However, I'm not sure, if it does not break something else.The text was updated successfully, but these errors were encountered: