From b2529a0091e2945e18751fc5b74b8219a7e5efc8 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sun, 9 Aug 2026 12:22:30 -0400 Subject: [PATCH] fix autocomplete in addtaskmodal not displaying --- src/constants/zIndex.js | 2 ++ src/views/TestView/AutocompleteDropdown.jsx | 12 +++++++----- src/views/components/SmartTaskTitleInput.jsx | 13 +++++-------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/constants/zIndex.js b/src/constants/zIndex.js index cc41e4d..59ab5e1 100644 --- a/src/constants/zIndex.js +++ b/src/constants/zIndex.js @@ -22,6 +22,8 @@ export const Z_INDEX = { MODAL_BACKDROP: 2000, MODAL_CONTENT: 2001, MODAL_CLOSE_BUTTON: 2002, + // Popups that must float above open modals (portaled to document.body) + MODAL_POPOVER: 2100, TOAST: 3000, // Critical System UI (9000-9999) diff --git a/src/views/TestView/AutocompleteDropdown.jsx b/src/views/TestView/AutocompleteDropdown.jsx index 685800e..aeb77a9 100644 --- a/src/views/TestView/AutocompleteDropdown.jsx +++ b/src/views/TestView/AutocompleteDropdown.jsx @@ -3,14 +3,16 @@ import { Add } from '@mui/icons-material' import { Divider, Menu, MenuItem } from '@mui/joy' import React, { useEffect } from 'react' +import { Z_INDEX } from '../../constants/zIndex' + const AutocompleteDropdown = ({ currentValue, - suggestions, - selectedIndex, - onSelectSuggestion, - onMouseEnterSuggestion, // Added for hover selection onCreateSuggestion, // Called when the "Create new" row is chosen + onMouseEnterSuggestion, // Added for hover selection + onSelectSuggestion, parentRefer, // Ref to the dropdown element + selectedIndex, + suggestions, }) => { // Scroll selected item into view const dropdownMenuRef = React.useRef(null) @@ -60,7 +62,7 @@ const AutocompleteDropdown = ({ position: 'relative', bottom: 0, left: 0, - zIndex: 1300, + zIndex: Z_INDEX.MODAL_POPOVER, }} > {filteredOptions.map((option, index) => ( diff --git a/src/views/components/SmartTaskTitleInput.jsx b/src/views/components/SmartTaskTitleInput.jsx index 0c9f12c..4b38458 100644 --- a/src/views/components/SmartTaskTitleInput.jsx +++ b/src/views/components/SmartTaskTitleInput.jsx @@ -89,17 +89,14 @@ const SmartTaskTitleInput = ({ } }, []) const handleSuggestionChange = text => { - // if the last word start with '@' or '#' or 'P': - const lastWord = text.split(' ').pop() - if ( - lastWord.startsWith('@') || - lastWord.startsWith('#') || - lastWord.startsWith('!') - ) { + // show the menu when the last word starts with a configured trigger + // character (e.g. '@', '#', '!', '*') + const lastWord = text.split(/\s+/).pop() + if (lastWord && suggestions?.[lastWord[0]]) { setSuggestionTrigger(lastWord[0]) // last word without the first character: setLastWord(lastWord.slice(1)) - + setSelectedSuggestionIndex(0) setShowSuggestions(true) } else { setShowSuggestions(false)