From 1ddc9b601e426fec0a244a2f4ee6147054f57060 Mon Sep 17 00:00:00 2001 From: Samson Akol Date: Wed, 20 May 2026 10:49:32 +0300 Subject: [PATCH 1/3] close dropdowns on mousedown instead of click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProseMirror calls preventDefault() on mouseup when repositioning the cursor, and ToolbarButton uses @mousedown.prevent — both suppress the click event per the HTML spec. Switching the document listener to mousedown makes dropdown close reliable for all interactions inside the editor. Fixes #5886 Co-Authored-By: Claude Sonnet 4.6 --- .../TipTapEditor/TipTapEditor/components/EditorToolbar.vue | 4 ++-- .../TipTapEditor/TipTapEditor/composables/useDropdowns.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/EditorToolbar.vue b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/EditorToolbar.vue index 41e6f73add..0abd2b3f7c 100644 --- a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/EditorToolbar.vue +++ b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/EditorToolbar.vue @@ -535,7 +535,7 @@ window.addEventListener('resize', handleWindowResize, { passive: true }); } - document.addEventListener('click', handleClickOutside, { passive: true }); + document.addEventListener('mousedown', handleClickOutside, { passive: true }); }); onUnmounted(() => { @@ -544,7 +544,7 @@ } else { window.removeEventListener('resize', handleWindowResize); } - document.removeEventListener('click', handleClickOutside); + document.removeEventListener('mousedown', handleClickOutside); }); return { diff --git a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/composables/useDropdowns.js b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/composables/useDropdowns.js index 311d77706c..c66d8b2e5e 100644 --- a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/composables/useDropdowns.js +++ b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/composables/useDropdowns.js @@ -93,7 +93,7 @@ export function useDropdowns() { }; onMounted(() => { - document.addEventListener('click', handleClickOutside); + document.addEventListener('mousedown', handleClickOutside); // Setup editor listener when component mounts setupEditorListener(); // Initial format detection @@ -101,7 +101,7 @@ export function useDropdowns() { }); onUnmounted(() => { - document.removeEventListener('click', handleClickOutside); + document.removeEventListener('mousedown', handleClickOutside); if (offTransaction) offTransaction(); }); From b2cc3abc7d4d121c0f808e20be045bb13f94279e Mon Sep 17 00:00:00 2001 From: Samson Akol Date: Tue, 26 May 2026 14:24:44 +0300 Subject: [PATCH 2/3] scope click-outside check to each dropdown's own container Replaces the global querySelectorAll('.dropdown-container') with a per-instance containerRef, so clicking one dropdown's trigger correctly closes the other instead of being treated as an inside click. Co-Authored-By: Claude Sonnet 4.6 --- .../components/toolbar/FormatDropdown.vue | 3 +++ .../components/toolbar/PasteDropdown.vue | 3 +++ .../TipTapEditor/composables/useDropdowns.js | 17 ++++++----------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/toolbar/FormatDropdown.vue b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/toolbar/FormatDropdown.vue index 053ed5b76d..7d5b2a4a1f 100644 --- a/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/toolbar/FormatDropdown.vue +++ b/contentcuration/contentcuration/frontend/shared/views/TipTapEditor/TipTapEditor/components/toolbar/FormatDropdown.vue @@ -1,6 +1,7 @@