From 1d4a8795c8c38384d8e670c21846de997dc22bf2 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 10 Jun 2024 14:28:50 +0200 Subject: [PATCH] fix(clipboard): if unsupported, don't hide element when button is on another target --- app/javascript/controllers/clipboard_controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/controllers/clipboard_controller.ts b/app/javascript/controllers/clipboard_controller.ts index d2b4ae1cf..cecdc5d93 100644 --- a/app/javascript/controllers/clipboard_controller.ts +++ b/app/javascript/controllers/clipboard_controller.ts @@ -17,7 +17,11 @@ export class ClipboardController extends Controller { connect(): void { // some extensions or browsers block clipboard if (!navigator.clipboard) { - this.element.classList.add('hidden'); + if (this.hasToHideTarget) { + this.toHideTarget.classList.add('hidden'); + } else { + this.element.classList.add('hidden'); + } } }