Dynamic Content Popover with Nested Interactive Tooltips
In modern web applications, rich and contextual information display is crucial for user experience. Imagine you're enhancing a dashboard where users need to quickly understand complex data points or interact with detailed user profiles without navigating away. This problem challenges you to build robust, reusable Popover and Tooltip components that can display dynamic content, handle various interactions, and ensure accessibility.
Your goal is to implement two core UI components: Popover and Tooltip, and demonstrate their combined usage.
Tooltip Component: Create a Tooltip component that displays a brief text message when the user hovers over or focuses on its child element. It should have a configurable delay before appearing and disappearing.Popover Component: Create a Popover component that displays arbitrary content. It should be triggered by clicking its child element and must close when the user clicks anywhere outside the popover or presses the Escape key.App.tsx skeleton, integrate these components. The main task involves a trigger element that opens a Popover containing detailed user information. Crucially, within this Popover's content, there should be another interactive element that itself triggers a Tooltip on hover/focus.Tooltip and Popover should appear relative to their respective trigger elements. The Popover should ideally appear below its trigger, centered horizontally, and adjust if it goes off-screen (though a basic relative position is sufficient for this round). The Tooltip should appear above or below its target.Tooltip should activate on mouseenter and focus, and deactivate on mouseleave and blur, with a short delay (e.g., 300ms). Popover should toggle on click of its trigger, and close on click outside or Escape key press.background, border, shadow).aria-haspopup, aria-expanded, aria-describedby, role) where relevant.Tooltip component correctly displays content on hover/focus and disappears on leave/blur, respecting a delay.Popover component correctly opens when its trigger is clicked.Popover closes when clicking outside its bounds.Popover closes when the Escape key is pressed.Popover and Tooltip are positioned visually close and relative to their respective trigger/child elements.Popover content dynamically renders the provided ReactNode (e.g., user details).Popover correctly triggers its own Tooltip.Constraints
Tooltip and Popover components from scratch. Do not use external UI component libraries (e.g., Material UI, Ant Design, Headless UI).App.tsx.Tooltip and Popover components are designed to be generic, reusable, and extensible.Loading editor...