From 1cc7d049a27f20c4608b4e3373545e36d115a37d Mon Sep 17 00:00:00 2001 From: Samson Akol Date: Wed, 20 May 2026 10:49:32 +0300 Subject: [PATCH] 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(); });