--- phase: 09-md3-components plan: "05" subsystem: ui tags: [react, tailwind, tooltip, accessibility, testing-library] # Dependency graph requires: - phase: 09-md3-components/09-04 provides: TextFieldMD3 component with suffix/helpText props provides: - Tooltip hover+click behavior in FieldRenderer (text and select branches) and PasswordField - helpTextPrefix prop on TextFieldMD3 for inline left-of-helpText slot - Tooltip icon rendered beside helpText below the field (not above the field) - Tests covering hover show/hide, click-pin, click-unpin, and helpTextPrefix rendering affects: [RemoteConfigStep, PasswordField, TextFieldMD3] # Tech tracking tech-stack: added: [] patterns: - "hoverTooltip + showTooltip dual-state: hover shows, click pins, click-unpin clears both" - "helpTextPrefix slot pattern: ReactNode prop for inline content left of helpText in TextFieldMD3" - "Click-to-unpin guard: setShowTooltip(v => { if (v) setHoverTooltip(false); return !v; })" key-files: created: [] modified: - src/components/ui/TextFieldMD3.tsx - src/components/ui/FieldRenderer.tsx - src/components/ui/PasswordField.tsx - src/components/ui/FieldRenderer.test.tsx - src/components/ui/TextFieldMD3.test.tsx key-decisions: - "Tooltip hover uses dual-state (hoverTooltip + showTooltip); click-unpin explicitly clears hoverTooltip to prevent sticky tooltip after dismiss" - "helpTextPrefix guard is (helpText || helpTextPrefix) not just helpText, enabling icon-only rendering when field has tooltipText but no helpText" - "Tooltip content rendered BELOW TextFieldMD3 (after component), not inside it — TextFieldMD3 stays self-contained" patterns-established: - "helpTextPrefix slot: pass ReactNode as inline prefix left of helpText text in TextFieldMD3" - "Hover+click tooltip: mouseEnter shows, mouseLeave hides, click pins, second-click clears both states" requirements-completed: [COMP-04] # Metrics duration: 10min completed: 2026-04-01 --- # Phase 9 Plan 05: Tooltip Placement and Hover Fix Summary **Tooltip icon moved from above field to inline with helpText below it, with hover-to-preview and click-to-pin behavior via dual hoverTooltip+showTooltip state** ## Performance - **Duration:** ~10 min - **Started:** 2026-04-01T09:10:00Z - **Completed:** 2026-04-01T09:20:34Z - **Tasks:** 2 - **Files modified:** 5 ## Accomplishments - Added `helpTextPrefix` prop to TextFieldMD3 for rendering inline content (tooltip icon) left of helpText below the field - Fixed tooltip icon position: moved from above the floating-label input to beside helpText below it - Implemented hover-to-preview (mouseEnter shows, mouseLeave hides) and click-to-pin (stays open through mouseLeave) in FieldRenderer and PasswordField - Fixed click-unpin edge case: second click explicitly clears hoverTooltip so tooltip dismisses even when mouse stays on button - Added 7 new tests covering all tooltip hover/pin/unpin behaviors and helpTextPrefix rendering ## Task Commits Each task was committed atomically: 1. **Task 1: Add helpTextPrefix prop and fix tooltip placement + hover** - `23617c0` (feat) 2. **Task 2: Add tests for tooltip hover behavior and helpTextPrefix rendering** - `d2b6da2` (test) ## Files Created/Modified - `src/components/ui/TextFieldMD3.tsx` - Added `helpTextPrefix?: React.ReactNode` prop; changed helpText guard to `(helpText || helpTextPrefix) && !error`; renders `