diff --git a/archon-ui-main/src/components/knowledge-base/EditableTags.tsx b/archon-ui-main/src/components/knowledge-base/EditableTags.tsx index f9ff19ba..ff314c6f 100644 --- a/archon-ui-main/src/components/knowledge-base/EditableTags.tsx +++ b/archon-ui-main/src/components/knowledge-base/EditableTags.tsx @@ -1,4 +1,5 @@ import React, { useState, useRef, useEffect } from 'react'; +import { createPortal } from 'react-dom'; import { X, Plus } from 'lucide-react'; import { Badge } from '../ui/Badge'; import { Input } from '../../features/ui/primitives/input'; @@ -35,6 +36,8 @@ export const EditableTags: React.FC = ({ const inputRef = useRef(null); const addInputRef = useRef(null); + const tooltipRef = useRef(null); + const [tooltipPosition, setTooltipPosition] = useState<{ x: number; y: number } | null>(null); // Prevent concurrent save operations const saveInProgress = useRef(false); @@ -328,9 +331,20 @@ export const EditableTags: React.FC = ({ {/* More tags tooltip */} {hasMoreTags && (
setShowTooltip(true)} - onMouseLeave={() => setShowTooltip(false)} + onMouseEnter={(e) => { + const rect = e.currentTarget.getBoundingClientRect(); + setTooltipPosition({ + x: rect.left + rect.width / 2, + y: rect.bottom + 8 + }); + setShowTooltip(true); + }} + onMouseLeave={() => { + setShowTooltip(false); + setTooltipPosition(null); + }} > = ({ > +{remainingTags.length} more... - {showTooltip && ( -
-
- Additional Tags: -
- {remainingTags.map((tag, index) => ( -
- • {tag} -
- ))} -
-
- )}
)} + {/* Portal tooltip for proper z-index layering */} + {showTooltip && tooltipPosition && createPortal( +
+
+ Additional Tags: +
+ {remainingTags.map((tag, index) => ( +
+ • {tag} +
+ ))} +
+
, + document.body + )} + {/* Error display */} {validationError && (