Skip to content

Fix mobile menu display#255

Open
Gijsreyn wants to merge 2 commits into
dsccommunity:masterfrom
Gijsreyn:gh-254/main/fix-menu-toggle
Open

Fix mobile menu display#255
Gijsreyn wants to merge 2 commits into
dsccommunity:masterfrom
Gijsreyn:gh-254/main/fix-menu-toggle

Conversation

@Gijsreyn

@Gijsreyn Gijsreyn commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Updates the mobile menu so all navigation options are visible and easy to select. The menu now opens in a clearer mobile-friendly layout, includes the full list of links, and closes when selecting a link, tapping outside the menu, or pressing Escape.

What was shown before:

image

(whilst pressing the menu, it overlayed totally incorrectly).

To what it is with this change:

image

Also fixes a page styling issue that could affect how the menu and other styles are displayed.


This change is Reviewable

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Replaces the transform-based .main-nav mobile navigation with a .mobile-menu overlay (CSS, HTML), updates JS to toggle/open/close with aria sync and body-scroll locking, adds i18n strings, and applies minor UI and formatting refinements.

Changes

Mobile Navigation Overlay System

Layer / File(s) Summary
Design tokens and header stacking
assets/css/futuristic.css
Reformatted --shadow-lg, --shadow-xl, and --font-sans; added --z-nav-mobile; changed .site-header z-index to var(--z-fixed).
Mobile menu CSS overlay system
assets/css/futuristic.css
Replaced mobile navigation under @media (max-width: 768px) with a .mobile-menu overlay system (backdrop, slide-in panel, header/close, list/link styling, nested submenu, footer actions).
Mobile navigation JavaScript handlers
assets/js/main.js
Refactored mobile menu to target #mobileMenu/#menuToggle, toggle open class, sync aria-expanded/aria-hidden, lock/unlock document.body.style.overflow, close on link click and Escape, added closeMobileMenu() and exposed both functions on window. Also added { passive: true } to scroll listener.
Mobile navigation markup and button integration
layouts/partials/header-new.html, assets/js/main.js
Switched header aria labels to i18n keys, set explicit aria-expanded="false" on toggle, reordered hamburger SVG lines, and added mobile-menu dialog markup rendering .Site.Menus.main items, grouped children, per-item icons, backdrop close behavior, and footer (theme toggle + GitHub).
Theme toggle and search refinements
assets/js/main.js
updateThemeToggle() now toggles visibility for all sun/moon icon variants; search results template marks the first result with focused.
Localization entries
i18n/en.toml, i18n/fr.toml
Added English and French keys for mobile menu open/close labels, mobile navigation title, theme toggle label, theme label, and GitHub label.
Formatting and minor adjustments
assets/css/futuristic.css, assets/js/main.js
Formatting-only reflows: .hero-grid background-image, .card:hover box-shadow expansion, timeline dark-mode selector change to [data-theme="dark"], highlightMatch() template formatting, and trailing comma in IntersectionObserver options.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix mobile menu display' directly describes the main purpose of the pull request, which is to improve the mobile menu layout and functionality.
Description check ✅ Passed The description is clearly related to the changeset, explaining the mobile menu improvements with before/after visuals and mentioning styling fixes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@assets/css/futuristic.css`:
- Around line 83-85: The CSS custom property --font-sans has unquoted
font-family keywords (e.g., BlinkMacSystemFont and Roboto) causing Stylelint
value-keyword-case errors; fix it by quoting any multi-word or capitalized font
family names and ensuring consistent quotes for the list used in --font-sans
(e.g., wrap BlinkMacSystemFont and Roboto in quotes or use consistent quoting
for all family names) so Stylelint passes when validating the font-family token.

In `@assets/js/main.js`:
- Around line 105-125: The menu button label isn't updated when toggling the
menu; update the button text/label in both toggleMobileMenu() and
closeMobileMenu() so screen readers see current intent: after toggling open in
toggleMobileMenu() set the menuToggle element's visible label (e.g., textContent
or aria-label) to "Close menu" when isOpen is true and "Open menu" when false,
and in closeMobileMenu() explicitly set menuToggle's label to "Open menu" (or
update aria-label/textContent consistently) while still updating aria-expanded;
reference the elements with IDs "mobileMenu" and "menuToggle" inside those
functions.

In `@layouts/partials/header-new.html`:
- Around line 173-178: Add an aria-controls attribute to the mobile menu toggle
so assistive tech knows which element it controls: update the button with id
"menuToggle" (which calls toggleMobileMenu()) to include
aria-controls="mobileMenu" that matches the mobile menu element's id (e.g., the
menu dialog element should have id="mobileMenu").
- Around line 176-177: The header template contains hardcoded English UI strings
(e.g., the mobile menu button aria-label "Open menu" and other new menu
labels/buttons referenced around the same region) that must be replaced with
i18n keys; update the elements that currently use literal text and aria
attributes (refer to the mobile menu button and the labels introduced near the
other noted blocks) to call the project's localization helper (use the same
i18n/key pattern used elsewhere in the project) and add corresponding string
keys to the locale files so all locales render correctly and no orphaned keys
remain.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 932a18c3-6824-4c14-aaeb-6eec7cff8493

📥 Commits

Reviewing files that changed from the base of the PR and between 6229ee8 and a585e9c.

📒 Files selected for processing (3)
  • assets/css/futuristic.css
  • assets/js/main.js
  • layouts/partials/header-new.html

Comment thread assets/css/futuristic.css
Comment thread assets/js/main.js
Comment thread layouts/partials/header-new.html
Comment thread layouts/partials/header-new.html Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
layouts/partials/header-new.html (1)

173-178: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add aria-controls="mobileMenu" to complete the accessibility binding.

The past review comment requesting aria-controls="mobileMenu" on this button remains unaddressed. Adding it explicitly binds the toggle to the controlled element for assistive technology.

♿ Proposed addition
 <button
   class="menu-toggle"
   id="menuToggle"
   aria-label="{{ i18n "mobileMenuOpenAriaLabel" }}"
   aria-expanded="false"
+  aria-controls="mobileMenu"
   onclick="toggleMobileMenu()"
 >
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@layouts/partials/header-new.html` around lines 173 - 178, The menu toggle
button lacks an explicit aria-controls binding; add aria-controls="mobileMenu"
to the element with id "menuToggle" (the button that calls toggleMobileMenu())
so assistive tech knows it controls the element with id "mobileMenu".
🧹 Nitpick comments (2)
layouts/partials/header-new.html (2)

202-202: 💤 Low value

Consider using <div role="dialog"> for semantic clarity.

The <aside> element is semantically meant for tangentially related content. For a modal dialog overlay, <div role="dialog"> or the native <dialog> element is more appropriate.

🎨 Semantic alternative
-<aside class="mobile-menu-panel" role="dialog" aria-modal="true" aria-label="{{ i18n "mobileNavigationAriaLabel" }}">
+<div class="mobile-menu-panel" role="dialog" aria-modal="true" aria-label="{{ i18n "mobileNavigationAriaLabel" }}">
   ...
-</aside>
+</div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@layouts/partials/header-new.html` at line 202, The mobile overlay currently
uses an <aside class="mobile-menu-panel"> which is semantically for tangential
content; change this element to either a <div role="dialog"> or a native
<dialog> to reflect its modal behavior (preserve class="mobile-menu-panel" and
all aria attributes like aria-modal and aria-label/i18n). Update any JS/CSS that
target the aside selector (e.g., queries or styles referencing
aside.mobile-menu-panel) to the new selector (div.mobile-menu-panel or
dialog.mobile-menu-panel) and ensure focus management/aria attributes remain
unchanged on the element used by the mobile menu code.

59-71: ⚡ Quick win

Extract icon selection logic to a Hugo partial to eliminate triplication.

The icon-mapping logic for menu items (Communityri-team-line, Resource Modulesri-apps-2-line, etc.) is repeated three times: desktop dropdown (lines 59–71), mobile submenu (lines 226–238), and mobile top-level items (lines 249–258). Centralizing this in a partial (e.g., layouts/partials/menu-icon.html) reduces maintenance cost and keeps mappings consistent.

♻️ Refactor direction

Create layouts/partials/menu-icon.html:

{{- $name := . -}}
{{- if eq $name "Community" -}}
<i class="ri-team-line"></i>
{{- else if eq $name "Resource Modules" -}}
<i class="ri-apps-2-line"></i>
{{- else if eq $name "Guidelines" -}}
<i class="ri-book-open-line"></i>
{{- else if eq $name "Blog Posts" -}}
<i class="ri-article-line"></i>
{{- else if eq $name "Config. Management" -}}
<i class="ri-settings-3-line"></i>
{{- else if eq $name "Code of Conduct" -}}
<i class="ri-shield-check-line"></i>
{{- else if eq $name "Community Calls" -}}
<i class="ri-calendar-event-line"></i>
{{- else if eq $name "FAQ" -}}
<i class="ri-question-answer-line"></i>
{{- else if eq $name "Help" -}}
<i class="ri-lifebuoy-line"></i>
{{- else -}}
<i class="ri-file-text-line"></i>
{{- end -}}

Then replace each block with {{ partial "menu-icon.html" .Name }}.

Also applies to: 226-238, 249-258

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@layouts/partials/header-new.html` around lines 59 - 71, Create a new Hugo
partial named menu-icon.html that accepts the menu item name (use the passed-in
.Name) and centralizes the mapping of names to icon markup
(Community→ri-team-line, Resource Modules→ri-apps-2-line,
Guidelines→ri-book-open-line, Blog Posts→ri-article-line, Config.
Management→ri-settings-3-line, Code of Conduct→ri-shield-check-line, Community
Calls→ri-calendar-event-line, FAQ→ri-question-answer-line,
Help→ri-lifebuoy-line, default→ri-file-text-line); then replace each duplicated
icon block in header-new.html (the desktop dropdown block using .Name, the
mobile submenu block, and the mobile top-level items) with a call to the
partial: pass .Name into partial "menu-icon.html" so all three places use the
single source of truth for icons.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@layouts/partials/header-new.html`:
- Around line 173-178: The menu toggle button lacks an explicit aria-controls
binding; add aria-controls="mobileMenu" to the element with id "menuToggle" (the
button that calls toggleMobileMenu()) so assistive tech knows it controls the
element with id "mobileMenu".

---

Nitpick comments:
In `@layouts/partials/header-new.html`:
- Line 202: The mobile overlay currently uses an <aside
class="mobile-menu-panel"> which is semantically for tangential content; change
this element to either a <div role="dialog"> or a native <dialog> to reflect its
modal behavior (preserve class="mobile-menu-panel" and all aria attributes like
aria-modal and aria-label/i18n). Update any JS/CSS that target the aside
selector (e.g., queries or styles referencing aside.mobile-menu-panel) to the
new selector (div.mobile-menu-panel or dialog.mobile-menu-panel) and ensure
focus management/aria attributes remain unchanged on the element used by the
mobile menu code.
- Around line 59-71: Create a new Hugo partial named menu-icon.html that accepts
the menu item name (use the passed-in .Name) and centralizes the mapping of
names to icon markup (Community→ri-team-line, Resource Modules→ri-apps-2-line,
Guidelines→ri-book-open-line, Blog Posts→ri-article-line, Config.
Management→ri-settings-3-line, Code of Conduct→ri-shield-check-line, Community
Calls→ri-calendar-event-line, FAQ→ri-question-answer-line,
Help→ri-lifebuoy-line, default→ri-file-text-line); then replace each duplicated
icon block in header-new.html (the desktop dropdown block using .Name, the
mobile submenu block, and the mobile top-level items) with a call to the
partial: pass .Name into partial "menu-icon.html" so all three places use the
single source of truth for icons.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 522f6429-46e7-48e1-abab-134cf0691441

📥 Commits

Reviewing files that changed from the base of the PR and between a585e9c and 768cf73.

📒 Files selected for processing (3)
  • i18n/en.toml
  • i18n/fr.toml
  • layouts/partials/header-new.html
✅ Files skipped from review due to trivial changes (2)
  • i18n/en.toml
  • i18n/fr.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant