Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Fix the user menu dropdown not opening in inquire mode after the recent header polish — the click-outside handler in shared-components.js's useUserMenu was identifying the trigger button by matching its class string against the substring 'flex items-center gap' which was true for the previous bespoke button (flex items-center gap-1 sm:gap-2 p-2 rounded-lg hover:bg-tertiary) but is false for the new .btn.btn--ghost.btn--sm primitive that the inquire UI polish commit switched to; the menu opened on click via Vue's @click handler and was then immediately closed by the document-level handler in the same tick because the matcher saw the click as outside the menu; switched to the data-user-menu-toggle and data-user-menu-dropdown attributes that have always been on those elements as their purpose-built identifier (e.target.closest('[data-user-menu-toggle]') instead of class pattern matching) so the handler is invariant to design-system class changes; also removed the now-redundant 'querySelector('i.fa-user-circle')' check since the data-attribute presence is itself sufficient
Murtaza Nasir4b47eb4b2993
diff --git a/static/js/shared-components.js b/static/js/shared-components.jsindex 6ad28da7..e68666a4 100644--- a/static/js/shared-components.js+++ b/static/js/shared-components.js@@ -227,20 +227,26 @@ function useUserMenu() {isUserMenuOpen.value = false;};- // Close menu when clicking outside+ // Close menu when clicking outside. Use the two purpose-built+ // data attributes (data-user-menu-toggle on the trigger button,+ // data-user-menu-dropdown on the dropdown panel) instead of class+ // pattern matching — the previous class-substring matcher+ // ('flex items-center gap...') broke as soon as the trigger+ // button was rewritten to use design-system primitives (.btn,+ // .btn--ghost, etc.) because the substring no longer matched and+ // every click read as "outside the menu", so the dropdown was+ // closed in the same tick it was opened.Vue.onMounted(() => {const handleClickOutside = (e) => {- const userMenuButton = e.target.closest('button[class*="flex items-center gap"]');- const userMenuDropdown = e.target.closest('div[class*="absolute right-0"]');- const isUserMenuButtonClick = userMenuButton && userMenuButton.querySelector('i.fa-user-circle');-- if (!isUserMenuButtonClick && !userMenuDropdown) {+ const userMenuToggle = e.target.closest('[data-user-menu-toggle]');+ const userMenuDropdown = e.target.closest('[data-user-menu-dropdown]');+ if (!userMenuToggle && !userMenuDropdown) {isUserMenuOpen.value = false;}};-+document.addEventListener('click', handleClickOutside);-+Vue.onUnmounted(() => {document.removeEventListener('click', handleClickOutside);});