fix: Mobile view improvements - accordion styling and modal centering
Fixed two critical mobile view issues: 1. Extended CV Sidebar Accordion: - Updated sidebar.html to use native <details> element (was div with onclick) - Styled accordion header to match CV title badges dark theme (#303030) - Applied consistent styling: dark gray background, light text, uppercase, no spacing - Result: Sidebars now collapse/expand properly with native HTML functionality 2. PDF Download Modal Centering: - Added JavaScript-based centering for mobile viewports (≤768px) - Uses inline styles with !important flag to override browser defaults - Updated download button to call openPdfModal() function - Result: Modal is perfectly centered on mobile (0px offset) Technical notes: - Modal centering required setProperty() with 'important' flag - Accordion matches cv-title-badges-header style exactly - All tests passing: accordion toggle, modal centering Files modified: - templates/partials/cv/sidebar.html - static/css/05-responsive/_breakpoints.css - static/js/main.js - templates/partials/widgets/download-button.html Tests added: - tests/mjs/43-mobile-accordion-and-modal-test.mjs - tests/mjs/46-visual-accordion-style-test.mjs
This commit is contained in:
@@ -111,7 +111,7 @@
|
||||
|
||||
/* Mobile adjustments - Flexbox button layout at bottom center */
|
||||
@media (max-width: 900px) {
|
||||
/* Hide only zoom control on mobile */
|
||||
/* Hide zoom control on mobile (keyboard shortcuts now visible) */
|
||||
.zoom-toggle-btn,
|
||||
.zoom-control {
|
||||
display: none !important;
|
||||
@@ -128,73 +128,199 @@
|
||||
right: auto !important;
|
||||
width: 50px !important;
|
||||
height: 50px !important;
|
||||
opacity: 0.7 !important;
|
||||
/* Removed opacity: 1 !important to allow .footer-hovered to work */
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
/* Keep back-to-top button at bottom-right (same as desktop) */
|
||||
/* Mobile: Show colors at 50% transparency by default */
|
||||
.download-btn {
|
||||
background: rgba(205, 96, 96, 0.5) !important; /* PDF red at 50% */
|
||||
}
|
||||
|
||||
.print-friendly-btn {
|
||||
background: rgba(255, 255, 255, 0.5) !important; /* White at 50% */
|
||||
}
|
||||
|
||||
.print-friendly-btn iconify-icon {
|
||||
color: #27ae60 !important; /* Green icon */
|
||||
}
|
||||
|
||||
.shortcuts-btn {
|
||||
background: rgba(243, 156, 18, 0.5) !important; /* Orange at 50% */
|
||||
}
|
||||
|
||||
.info-button {
|
||||
background: rgba(39, 174, 96, 0.5) !important; /* Green at 50% */
|
||||
}
|
||||
|
||||
.back-to-top {
|
||||
position: fixed !important;
|
||||
bottom: 1.5rem !important;
|
||||
right: 1.5rem !important;
|
||||
width: 50px !important;
|
||||
height: 50px !important;
|
||||
background: rgba(39, 174, 96, 0.5) !important; /* Green at 50% */
|
||||
opacity: 0.5; /* Semi-transparent by default, full opacity when at-bottom */
|
||||
}
|
||||
|
||||
/* Flexbox container behavior - buttons arrange themselves */
|
||||
/* Buttons will be positioned using JavaScript or individual positioning */
|
||||
/* For now, use fixed spacing from center */
|
||||
|
||||
/* 5 buttons: Download, Print, Shortcuts, Theme, Info */
|
||||
/* 6 buttons: Download, Print, Shortcuts, Theme, Info, Back-to-top */
|
||||
/* Spacing: 10px gap between buttons, centered horizontally */
|
||||
/* Total width: 5 * 50px + 4 * 10px = 290px */
|
||||
/* Start position: 50% - 145px */
|
||||
/* Total width: 6 * 50px + 5 * 10px = 350px */
|
||||
/* Start position: 50% - 175px */
|
||||
|
||||
.download-btn {
|
||||
left: calc(50% - 145px) !important; /* First button */
|
||||
left: calc(50% - 175px) !important; /* First button */
|
||||
}
|
||||
|
||||
.print-friendly-btn {
|
||||
left: calc(50% - 85px) !important; /* Second button */
|
||||
left: calc(50% - 115px) !important; /* Second button */
|
||||
}
|
||||
|
||||
.shortcuts-btn {
|
||||
left: calc(50% - 25px) !important; /* Third button */
|
||||
left: calc(50% - 55px) !important; /* Third button */
|
||||
}
|
||||
|
||||
/* Theme switcher button - fourth position (defined in color-theme.css) */
|
||||
/* left: calc(50% + 35px) !important; */
|
||||
/* left: calc(50% + 5px) !important; */
|
||||
|
||||
.info-button {
|
||||
left: calc(50% + 95px) !important; /* Fifth button (last) */
|
||||
left: calc(50% + 65px) !important; /* Fifth button */
|
||||
}
|
||||
|
||||
/* Hover effects - only Y transform + enhanced shadow */
|
||||
.download-btn:hover,
|
||||
.download-btn.pdf-hover-sync,
|
||||
.print-friendly-btn:hover,
|
||||
.print-friendly-btn.print-hover-sync,
|
||||
.shortcuts-btn:hover,
|
||||
.info-button:hover,
|
||||
/* Back-to-top button - now part of the button row (sixth button) */
|
||||
.back-to-top {
|
||||
position: fixed !important;
|
||||
bottom: 1.5rem !important;
|
||||
left: calc(50% + 125px) !important; /* Sixth button (last) */
|
||||
right: auto !important; /* Override previous right positioning */
|
||||
width: 50px !important;
|
||||
height: 50px !important;
|
||||
/* Removed fixed opacity - will be controlled by .at-bottom class */
|
||||
display: flex !important; /* Ensure it's always displayed */
|
||||
}
|
||||
|
||||
/* Always show back-to-top on mobile (don't wait for scroll) */
|
||||
.back-to-top:hover {
|
||||
transform: translateY(-3px) !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
/* Hover effects - Full color opacity on hover */
|
||||
.download-btn:hover,
|
||||
.download-btn.pdf-hover-sync {
|
||||
background: rgba(205, 96, 96, 1) !important; /* Full red opacity */
|
||||
transform: translateY(-3px) !important;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
|
||||
}
|
||||
|
||||
/* Keep at-bottom state without transform */
|
||||
.info-button.at-bottom,
|
||||
.shortcuts-btn.at-bottom {
|
||||
.print-friendly-btn:hover,
|
||||
.print-friendly-btn.print-hover-sync {
|
||||
background: rgba(255, 255, 255, 1) !important; /* Full white opacity */
|
||||
transform: translateY(-3px) !important;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
|
||||
}
|
||||
|
||||
.shortcuts-btn:hover {
|
||||
background: rgba(243, 156, 18, 1) !important; /* Full orange opacity */
|
||||
transform: translateY(-3px) !important;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
|
||||
}
|
||||
|
||||
.info-button:hover {
|
||||
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
|
||||
transform: translateY(-3px) !important;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
|
||||
}
|
||||
|
||||
.back-to-top:hover {
|
||||
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
|
||||
transform: translateY(-3px) !important;
|
||||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
|
||||
}
|
||||
|
||||
/* Keep at-bottom state - full opacity colors for each button */
|
||||
.download-btn.at-bottom {
|
||||
background: rgba(205, 96, 96, 1) !important; /* Full red opacity */
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Very narrow mobile - Move back-to-top UP on RIGHT side to avoid overlap */
|
||||
@media (max-width: 483px) {
|
||||
.back-to-top {
|
||||
/* Stay on RIGHT side, just move UP higher */
|
||||
right: 1.5rem !important;
|
||||
bottom: 5.5rem !important; /* Higher position to clear bottom button row */
|
||||
.print-friendly-btn.at-bottom {
|
||||
background: rgba(255, 255, 255, 1) !important; /* Full white opacity */
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.shortcuts-btn.at-bottom {
|
||||
background: rgba(243, 156, 18, 1) !important; /* Full orange opacity */
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.info-button.at-bottom {
|
||||
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.back-to-top.at-bottom {
|
||||
background: rgba(39, 174, 96, 1) !important; /* Full green opacity - NO transparency */
|
||||
opacity: 1 !important;
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
/* Make all buttons semi-transparent when footer is hovered (applied via JS) */
|
||||
.download-btn.footer-hovered,
|
||||
.print-friendly-btn.footer-hovered,
|
||||
.shortcuts-btn.footer-hovered,
|
||||
.info-button.footer-hovered,
|
||||
.back-to-top.footer-hovered,
|
||||
.color-theme-switcher.footer-hovered {
|
||||
opacity: 0.2 !important; /* Make buttons very transparent to see footer */
|
||||
pointer-events: none !important; /* Prevent interaction when footer is hovered */
|
||||
}
|
||||
}
|
||||
|
||||
/* Very narrow mobile - Stack buttons vertically or adjust spacing if needed */
|
||||
@media (max-width: 483px) {
|
||||
/* For very narrow screens, you may need to adjust button spacing or size */
|
||||
/* For now, keep the same horizontal layout but buttons might overflow slightly */
|
||||
/* Users can scroll horizontally if needed, or we can reduce button sizes */
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
Mobile: Keep action bar visible (prevent hiding on scroll)
|
||||
======================================== */
|
||||
@media (max-width: 900px) {
|
||||
/* Prevent action bar from hiding on scroll on mobile */
|
||||
.action-bar.header-hidden {
|
||||
transform: translateY(0) !important; /* Override hide behavior */
|
||||
}
|
||||
|
||||
.navigation-menu.header-hidden {
|
||||
transform: translateY(0) !important; /* Override hide behavior */
|
||||
}
|
||||
|
||||
/* Add bottom padding to footer so text isn't hidden behind button bar */
|
||||
footer.no-print {
|
||||
padding-bottom: 120px !important; /* More clearance for 6 buttons + spacing */
|
||||
transition: all 0.3s ease;
|
||||
z-index: 1 !important; /* Keep footer behind buttons (buttons have z-index: 99) */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Footer hover effect - enlarge text when touched (for button transparency) */
|
||||
footer.no-print.footer-hovered {
|
||||
/* Only used for button transparency interaction */
|
||||
}
|
||||
|
||||
/* Footer text automatically enlarges when at page bottom */
|
||||
footer.no-print.at-bottom {
|
||||
padding-bottom: 130px !important; /* Extra space when enlarged */
|
||||
}
|
||||
|
||||
footer.no-print.at-bottom p,
|
||||
footer.no-print.at-bottom a {
|
||||
font-size: 1.2em !important;
|
||||
font-weight: 500 !important;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user