mirror of
https://github.com/kbenestad/mdcms.git
synced 2026-06-18 07:24:31 +00:00
Fix mobile hamburger not showing: replace inline-style+!important hack with a base CSS rule
The mobile header was hidden via mobileHeader.style.display='none' (inline style),
then a dynamically-injected <style> with !important was supposed to reveal it on mobile.
Inline styles and injected stylesheets interact inconsistently across browsers, making
the hamburger invisible on mobile in practice.
Replace with a simple CSS-only approach: add a base rule
'.layout-sidebar .mobile-header { display: none; }' so the existing media-query
'display: flex' override works through normal cascade — no inline style needed,
no !important injection needed.
https://claude.ai/code/session_01HRJsjppKZ2cpmNUAV2NXds
This commit is contained in:
parent
b69af5dfa2
commit
a67d731700
1 changed files with 2 additions and 5 deletions
|
|
@ -187,6 +187,8 @@ body {
|
|||
.sidebar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }
|
||||
.sidebar::-webkit-scrollbar-track { background: var(--scrollbar-track); }
|
||||
|
||||
.layout-sidebar .mobile-header { display: none; }
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
SIDEBAR CONTENT
|
||||
═══════════════════════════════════════════ */
|
||||
|
|
@ -2018,7 +2020,6 @@ function fmtDatetime(dtStr) {
|
|||
const layout = el('div', { className: `layout-sidebar nav-${navPos}` });
|
||||
|
||||
const mobileHeader = el('div', { className: 'mobile-header' });
|
||||
mobileHeader.style.display = 'none';
|
||||
const hamburger = el('button', { className: 'hamburger', 'aria-label': 'Open menu' });
|
||||
hamburger.appendChild(iconEl('menu'));
|
||||
const mobileName = el('span', { className: 'sidebar-sitename', textContent: config.sitename || 'MD-CMS' });
|
||||
|
|
@ -2028,10 +2029,6 @@ function fmtDatetime(dtStr) {
|
|||
}
|
||||
mobileHeader.appendChild(mobileName);
|
||||
|
||||
const mobileStyle = document.createElement('style');
|
||||
mobileStyle.textContent = `@media (max-width: 768px) { .layout-sidebar .mobile-header { display: flex !important; } }`;
|
||||
document.head.appendChild(mobileStyle);
|
||||
|
||||
const overlay = el('div', { className: 'mobile-overlay' });
|
||||
overlay.addEventListener('click', () => closeMobileMenu());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue