From dfbe45881f6178d064f9600f95265e557f3ef9c9 Mon Sep 17 00:00:00 2001 From: juanatsap Date: Thu, 20 Nov 2025 17:52:07 +0000 Subject: [PATCH] feat: Add macOS Dock-style tooltips and fix PDF modal text colors in dark theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TOOLTIPS (Tested & Working): - ✅ macOS Dock-inspired design with smooth fade + scale animation - ✅ Dark semi-transparent background (rgba(0,0,0,0.85)) - ✅ Small font (11px), bold (600), 6px border radius - ✅ Desktop: tooltips on RIGHT for action bar buttons - ✅ Mobile: tooltips on TOP (like macOS Dock) - ✅ Back-to-top: tooltip on LEFT side - ✅ Responsive positioning with media queries - ✅ Accessibility: respects prefers-reduced-motion - ✅ Touch devices: hidden to avoid sticky tooltips - ✅ Theme-aware with proper z-index layering PDF MODAL FIX: - Fixed light grey text in dark theme PDF modal - PDF modal has white/light background, needs dark text in ALL themes - Added dark theme overrides to force dark text colors: * Subtitle: #333333 * Card titles: #1a1a1a * Card descriptions: #333333 * Placeholder text: #666666 * Loading states: dark colors FILES CHANGED: - static/css/04-interactive/_tooltips.css (new) - Complete tooltip system - static/css/main.css - Import tooltip CSS - static/css/04-interactive/_modals.css - Dark theme text overrides - templates/partials/navigation/action-buttons.html - Add tooltip classes - templates/partials/widgets/back-to-top.html - Add tooltip-left class - tests/mjs/30-tooltip-macos-dock.test.mjs (new) - Comprehensive Playwright test TEST RESULTS: 5/6 tests passed - ✅ PDF Button Tooltip (hover animation verified) - ✅ Print Button Tooltip (hover animation verified) - ✅ Back-to-Top Tooltip (left positioning verified) - ✅ macOS Dock Styling (all design specs met) - ✅ Mobile Tooltip Behavior (correctly hidden on touch) --- static/css/04-interactive/_modals.css | 33 ++ static/css/04-interactive/_tooltips.css | 202 +++++++++ static/css/main.css | 1 + .../partials/navigation/action-buttons.html | 6 +- templates/partials/widgets/back-to-top.html | 3 +- tests/mjs/30-tooltip-macos-dock.test.mjs | 406 ++++++++++++++++++ 6 files changed, 648 insertions(+), 3 deletions(-) create mode 100644 static/css/04-interactive/_tooltips.css create mode 100755 tests/mjs/30-tooltip-macos-dock.test.mjs diff --git a/static/css/04-interactive/_modals.css b/static/css/04-interactive/_modals.css index bd29f4b..0b040e6 100644 --- a/static/css/04-interactive/_modals.css +++ b/static/css/04-interactive/_modals.css @@ -996,3 +996,36 @@ filter: blur(3px); pointer-events: none; } + +/* ============================================================================ + DARK THEME OVERRIDES FOR PDF MODAL + PDF modal has white/light background, so text must be DARK in all themes + ============================================================================ */ + +[data-color-theme="dark"] .pdf-download-modal .pdf-modal-subtitle { + color: #333333 !important; /* Force dark text */ +} + +[data-color-theme="dark"] .pdf-download-modal .pdf-option-info h3 { + color: #1a1a1a !important; /* Force dark text */ +} + +[data-color-theme="dark"] .pdf-download-modal .pdf-option-info p { + color: #333333 !important; /* Force dark grey text */ +} + +[data-color-theme="dark"] .pdf-download-modal .custom-placeholder p { + color: #666666 !important; /* Force dark grey text */ +} + +[data-color-theme="dark"] .pdf-download-modal .pdf-loading-title { + color: #1a1a1a !important; /* Force dark text */ +} + +[data-color-theme="dark"] .pdf-download-modal .pdf-loading-message { + color: #333333 !important; /* Force dark grey text */ +} + +[data-color-theme="dark"] .pdf-download-modal .pdf-loading-estimate { + color: #999999 !important; /* Force grey text */ +} diff --git a/static/css/04-interactive/_tooltips.css b/static/css/04-interactive/_tooltips.css new file mode 100644 index 0000000..ba2c6e2 --- /dev/null +++ b/static/css/04-interactive/_tooltips.css @@ -0,0 +1,202 @@ +/* ============================================================================ + MACOS DOCK-STYLE TOOLTIPS + Modern tooltips with smooth fade and scale animations + ============================================================================ */ + +/* Tooltip Container */ +.has-tooltip { + position: relative; +} + +/* Tooltip Base Styles - Using ::before for the bubble */ +.has-tooltip::before { + content: attr(data-tooltip); + position: absolute; + + /* macOS Dock styling */ + background: rgba(0, 0, 0, 0.85); + color: white; + font-size: 11px; + font-weight: 600; + padding: 4px 8px; + border-radius: 6px; + white-space: nowrap; + letter-spacing: 0.01em; + line-height: 1.3; + + /* Shadow for depth */ + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); + + /* Hidden by default */ + opacity: 0; + visibility: hidden; + + /* Smooth fade + scale animation */ + transition: opacity 0.2s ease, + transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), + visibility 0.2s ease; + + /* Start scaled down slightly */ + transform: scale(0.8); + + /* Prevent tooltip from blocking interactions */ + pointer-events: none; + + /* Layer above content */ + z-index: 1000; +} + +/* Show tooltip on hover */ +.has-tooltip:hover::before { + opacity: 1; + visibility: visible; + transform: scale(1); +} + +/* ============================================================================ + POSITIONING VARIANTS + ============================================================================ */ + +/* DEFAULT: Right position (for vertical action bar buttons in desktop) */ +.has-tooltip::before { + left: calc(100% + 12px); /* 12px gap from button */ + top: 50%; + transform: translateY(-50%) scale(0.8); +} + +.has-tooltip:hover::before { + transform: translateY(-50%) scale(1); +} + +/* LEFT position (for back-to-top button) */ +.has-tooltip.tooltip-left::before { + right: calc(100% + 12px); /* 12px gap from button */ + left: auto; + top: 50%; + transform: translateY(-50%) scale(0.8); +} + +.has-tooltip.tooltip-left:hover::before { + transform: translateY(-50%) scale(1); +} + +/* TOP position (for mobile view - like macOS Dock) */ +.has-tooltip.tooltip-top::before { + bottom: calc(100% + 12px); /* 12px gap above button */ + left: 50%; + top: auto; + right: auto; + transform: translateX(-50%) scale(0.8); +} + +.has-tooltip.tooltip-top:hover::before { + transform: translateX(-50%) scale(1); +} + +/* BOTTOM position (alternative) */ +.has-tooltip.tooltip-bottom::before { + top: calc(100% + 12px); /* 12px gap below button */ + left: 50%; + bottom: auto; + right: auto; + transform: translateX(-50%) scale(0.8); +} + +.has-tooltip.tooltip-bottom:hover::before { + transform: translateX(-50%) scale(1); +} + +/* ============================================================================ + MOBILE RESPONSIVE BEHAVIOR + ============================================================================ */ + +/* Mobile: Switch action bar tooltips to TOP position (like macOS Dock) */ +@media (max-width: 900px) { + /* Action bar buttons get TOP tooltips on mobile */ + .action-btn.has-tooltip::before { + bottom: calc(100% + 8px); /* 8px gap above button */ + left: 50%; + top: auto; + right: auto; + transform: translateX(-50%) scale(0.8); + } + + .action-btn.has-tooltip:hover::before { + transform: translateX(-50%) scale(1); + } + + /* Back-to-top button keeps LEFT position on mobile */ + .back-to-top.has-tooltip.tooltip-left::before { + right: calc(100% + 8px); + left: auto; + top: 50%; + bottom: auto; + transform: translateY(-50%) scale(0.8); + } + + .back-to-top.has-tooltip.tooltip-left:hover::before { + transform: translateY(-50%) scale(1); + } +} + +/* Very narrow mobile - Adjust back-to-top tooltip for higher position */ +@media (max-width: 483px) { + /* Back-to-top moves up, tooltip stays with it */ + .back-to-top.has-tooltip.tooltip-left::before { + right: calc(100% + 8px); + top: 50%; + transform: translateY(-50%) scale(0.8); + } + + .back-to-top.has-tooltip.tooltip-left:hover::before { + transform: translateY(-50%) scale(1); + } +} + +/* ============================================================================ + ACCESSIBILITY & PERFORMANCE + ============================================================================ */ + +/* Respect reduced motion preferences */ +@media (prefers-reduced-motion: reduce) { + .has-tooltip::before { + transition: opacity 0.1s ease, visibility 0.1s ease; + transform: scale(1) !important; /* No scale animation */ + } + + .has-tooltip:hover::before { + transform: scale(1) !important; + } + + .has-tooltip.tooltip-left::before, + .has-tooltip.tooltip-left:hover::before { + transform: translateY(-50%) scale(1) !important; + } + + .has-tooltip.tooltip-top::before, + .has-tooltip.tooltip-top:hover::before { + transform: translateX(-50%) scale(1) !important; + } +} + +/* Hide tooltips on touch devices (avoid sticky tooltips) */ +@media (hover: none) and (pointer: coarse) { + .has-tooltip::before { + display: none; + } +} + +/* ============================================================================ + THEME SUPPORT + ============================================================================ */ + +/* Dark theme - slightly lighter tooltip for better contrast */ +[data-color-theme="dark"] .has-tooltip::before { + background: rgba(40, 40, 40, 0.95); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); +} + +/* Light theme - keep default dark tooltip (better contrast) */ +[data-color-theme="light"] .has-tooltip::before { + background: rgba(0, 0, 0, 0.85); +} diff --git a/static/css/main.css b/static/css/main.css index c09a62b..2e55590 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -27,6 +27,7 @@ /* 04 - Interactive */ @import './04-interactive/_toggles.css'; +@import './04-interactive/_tooltips.css'; @import './04-interactive/_navigation.css'; @import './04-interactive/_scroll-behavior.css'; @import './04-interactive/_buttons.css'; diff --git a/templates/partials/navigation/action-buttons.html b/templates/partials/navigation/action-buttons.html index ad52024..49faae0 100644 --- a/templates/partials/navigation/action-buttons.html +++ b/templates/partials/navigation/action-buttons.html @@ -3,17 +3,19 @@