for some reason the text of the tooltip span is not hidden properly when this highlight…
- User
for some reason the text of the tooltip span is not hidden properly when this highlight is initialized, anyway to force it to be hidden from react? In particular i want the textcontent to be "" UNLESS the user is hovering over it. export const Highlight = ({ children, id, annotation }: { children: React.ReactNode, id: string, annotation:string }) => { const [isVisible, setIsVisible] = useState(false);
codereturn ( <span id={id} className='highlight non-selectable' onMouseEnter={() => setIsVisible(true)} onMouseLeave={() => setIsVisible(false)}> {children} {isVisible && ( <span id={'tool'+id} className='tooltip non-selectable' aria-hidden='true'> {"TESTING123"} </span> )} </span> );};
- Assistant
To ensure that the tooltip text is hidden unless the user is hovering over the
Highlightcomponent, you can manage the visibility of the tooltip by using conditional rendering within React and leveraging CSS for additional control. Your approach is largely correct, but let's refine it for better reliability.