From c39eac81dd59c3bad8617fa86d30fc27c1600b04 Mon Sep 17 00:00:00 2001 From: leex279 Date: Sun, 7 Sep 2025 19:43:08 +0200 Subject: [PATCH] fix: tooltip z-index layering issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed the '+N more...' tooltip appearing behind other UI elements by using React Portal to render the tooltip at document.body level. - Uses createPortal to render tooltip outside stacking context - Calculates absolute position based on badge location - Uses z-index 10001 to ensure it's above all other elements - Maintains purple border styling for consistency The tooltip now properly appears above all UI elements including buttons, cards, and other components. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../knowledge-base/EditableTags.tsx | 54 +++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) 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 && (