Skip to content

feat(frontend/mobile): hamburger drawer nav for narrow viewports - #991

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/mobile-nav-drawer
Jun 5, 2026
Merged

cristim merged 1 commit into
feat/multicloud-web-frontendfrom
feat/mobile-nav-drawer

Conversation

@cristim

@cristim cristim commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a hamburger button to the topbar that opens the sidebar as a slide-in drawer on viewports at or below 768px (the project's existing mobile breakpoint).
  • The desktop layout is untouched; the hamburger is display: none above 768px.
  • Topbar filter chips wrap to a second row on mobile instead of overflowing.

Design

Breakpoint: 768px (matches the existing @media (max-width: 768px) in responsive.css).

Open: body.sidebar-open class added; sidebar translates from translateX(-100%) to translateX(0) with a 250ms ease transition; translucent overlay fades in behind the drawer.

Close: overlay click, Escape key, or any unmodified sidebar link click removes .sidebar-open and returns focus to the hamburger button.

Scroll lock: body.sidebar-open { overflow: hidden } prevents the page from scrolling while the drawer is open.

Filter chips: .app-topbar-filters gains flex-wrap: wrap on mobile so chips flow to a second row rather than overflowing or being clipped.

Accessibility

  • Hamburger: <button type="button" aria-controls="sidebar" aria-expanded="false"> with aria-expanded toggled on every state change.
  • Overlay: aria-hidden toggled.
  • Focus on open: first focusable element in the sidebar receives focus.
  • Focus on close: hamburger button receives focus.
  • Escape-to-close: keydown listener on document fires only when the drawer is open.
  • No full focus trap on the sidebar (it is a <nav>, not a role="dialog"; Tab naturally exits to main content, which is the expected mobile behaviour).

Test plan

  • 15 tests in frontend/src/__tests__/mobile-nav.test.ts
    • Hamburger click adds/removes .sidebar-open
    • aria-expanded toggles correctly
    • Overlay click closes the drawer
    • Escape key closes the drawer (no-op when already closed)
    • Sidebar link click closes the drawer
    • Modifier-key click does not close the drawer
    • aria-hidden on sidebar and overlay toggled correctly
    • No-op when hamburger or sidebar missing from DOM
  • Existing app.test.ts (16 tests) passes without changes
  • Existing html.test.ts (97 tests) passes without changes
  • npx tsc --noEmit clean

Out of scope

  • Full ARIA focus trap (the sidebar is a navigation landmark, not a dialog)
  • Swipe-to-close gesture
  • Moving filter chips into the drawer

- Add hamburger button (#hamburger-btn) to the topbar; hidden above
  768px via CSS (display: none), shown as inline-flex on mobile.
- Add sidebar overlay (#sidebar-overlay) that dims content while
  the drawer is open; click closes the drawer.
- Sidebar (#sidebar) slides in from the left with a CSS transition
  (transform: translateX(-100%) -> 0) when body.sidebar-open is set.
- Body scroll locked via body.sidebar-open { overflow: hidden }.
- Desktop collapse toggle (.app-sidebar-toggle) hidden on mobile
  (redundant with overlay/Escape/link-click close affordances).
- Filter chips (.app-topbar-filters) wrap to a second row on narrow
  viewports (flex-wrap: wrap) rather than overflowing.
- setupMobileNav() in app.ts wires: hamburger click, overlay click,
  Escape-to-close, sidebar link click (unmodified left-click only).
- Focus management: open focuses first sidebar link; close returns
  focus to hamburger button.
- aria-expanded on hamburger and aria-hidden on overlay toggled on
  every state change.
- 15 tests in mobile-nav.test.ts cover all interaction paths.

Design decisions:
- Breakpoint: 768px (matches the project's existing mobile breakpoint
  in responsive.css @media (max-width: 768px)).
- No new dependencies: no focus-trap library; focus management is a
  simple querySelector on the sidebar rather than a full trap (the
  sidebar is a nav, not a dialog; Tab naturally exits to the main
  content which is what mobile users expect).
- The existing .app-sidebar-toggle (desktop collapse button) is hidden
  on mobile rather than repurposed, to avoid coupling desktop and mobile
  close semantics.
@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 26 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ae125a19-01f1-417a-a8b2-e863c9e42690

📥 Commits

Reviewing files that changed from the base of the PR and between 55739c2 and a796d0e.

📒 Files selected for processing (4)
  • frontend/src/__tests__/mobile-nav.test.ts
  • frontend/src/app.ts
  • frontend/src/index.html
  • frontend/src/styles/responsive.css
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mobile-nav-drawer

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

@cristim cristim added priority/p2 Backlog-worthy severity/low Minor harm urgency/this-sprint Within the current sprint impact/many Affects most users enhancement New feature or request triaged Item has been triaged labels Jun 5, 2026
@cristim

cristim commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 735415a into feat/multicloud-web-frontend Jun 5, 2026
6 checks passed
@cristim
cristim deleted the feat/mobile-nav-drawer branch July 27, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request impact/many Affects most users priority/p2 Backlog-worthy severity/low Minor harm triaged Item has been triaged urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant