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:
parent
a43ac27381
commit
d7265ddd7f
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue