Bug 36275: (follow-up) Only show tooltip on successful copy

Question is whether we should display anything on the failure case as well?

Test plan stays the same.

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Paul Derscheid 2025-04-02 13:27:20 +00:00 committed by Katrin Fischer
parent a43ac27381
commit d7265ddd7f
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 6 additions and 2 deletions

View File

@ -3,7 +3,7 @@
"[data-copy-to-clipboard]"
);
if (copyToClipboardButtons.length) {
const copyToClipboard = e => {
const copyToClipboard = async e => {
const target = e.target;
if (!(target instanceof HTMLButtonElement)) {
return;
@ -13,7 +13,11 @@
return;
}
navigator.clipboard.writeText(value);
try {
await navigator.clipboard.writeText(value);
} catch (_) {
return;
}
target.title = __("Copied to clipboard");
const tooltip = bootstrap.Tooltip.getOrCreateInstance(target);