Skip to content

Conversation

ishanBahuguna
Copy link
Contributor

@ishanBahuguna ishanBahuguna commented Sep 5, 2025

Proposed change

Resolves #2066

  • Increased close icon tap area for better accessibility
  • Added hover effect on navigaion links with transition animation for improved responsiveness
  • Added extra padding and margin between menu items for readability and to make them easier to tap on mobile

Issues not addressed due to design constraints:

  • Menu slides over content: verified working on mobile and desktop.
  • Close icon tap area: increased slightly for better accessibility; increasing to 40x40px would make it too large for the design. Current size is clickable and functional.

Before: no effects

After:

owasp.mp4

Checklist

  • I've read and followed the contributing guidelines.
  • I've run make check-test locally; all checks and tests passed.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

Summary by CodeRabbit

  • Style
    • Improved mobile menu close button hit area and icon size.
    • Increased spacing in mobile header/logo and submenu; standardized mobile logo image height.
    • Enhanced top-level navigation links with transitions and hover states, including dark mode support.
    • Updated mobile submenu padding and spacing for better readability.
    • Revised mobile menu labels to “Star On Github” and “Sponsor Us”.
    • Grouped mobile action buttons into a vertically spaced container.

Walkthrough

Updated mobile navigation in frontend/src/components/Header.tsx: enlarged close button hit area, switched close icon to FontAwesome size "2x" when open, increased logo and submenu spacing, added submenu padding/gaps, adjusted top-level nav hover/transition classes, and updated two mobile action labels.

Changes

Cohort / File(s) Summary of Changes
Header — mobile menu & submenu
frontend/src/components/Header.tsx
Enlarged mobile close button container to flex h-11 w-11 items-center justify-center; FontAwesome close icon rendered with size="2x" when menu open; mobile logo images given h-16; mobile NavButton items wrapped in flex flex-col gap-y-2; submenu wrapper changed to flex flex-col gap-2; submenu headers/items padding increased to py-3; overall mobile submenu/item spacing increased; mobile action labels changed to “Star On Github” and “Sponsor Us”.
Header — top-level nav styling
frontend/src/components/Header.tsx
Replaced top-level nav link classes with a new set including transition duration-150 ease-in-out, hover:bg-slate-100 hover:text-slate-900, dark:hover:bg-slate-700, and dark:hover:text-white while preserving active-state logic; adjusted header/logo gap (e.g., gap-1gap-5 in mobile/header area).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Increase close icon tap area to min 40x40px (#2066)
Add extra spacing between menu items for readability (#2066)
Ensure menu slides over content instead of pushing it (#2066) No positioning (fixed/absolute/z-index/transform) changes visible in diff to confirm overlay behavior.
Test responsiveness across devices (#2066) Diff contains no device/responsiveness tests or runtime verification; cannot confirm.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Top-level nav hover/transition class updates (frontend/src/components/Header.tsx) Styling changes to desktop/top-level links are not specified in #2066 (issue focuses on mobile usability).
Header/logo gap adjustment in desktop/mobile header area (frontend/src/components/Header.tsx) Gap adjustments outside the mobile menu objectives in #2066; not requested.
Mobile menu label text changes to “Star On Github” and “Sponsor Us” (frontend/src/components/Header.tsx) Content/label edits are not part of #2066 objectives, which target spacing, hit area, and overlay behavior.

Possibly related PRs

Suggested reviewers

  • arkid15r

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ae62ac8 and 1ed027c.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Header.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run frontend unit tests
  • GitHub Check: Run backend tests
  • GitHub Check: Run frontend e2e tests
  • GitHub Check: CodeQL (javascript-typescript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
frontend/src/components/Header.tsx (2)

134-144: Meet 44×44 tap target and add ARIA/focus affordances for the mobile menu button

Icon size alone doesn’t guarantee the 40–44 px minimum hit area (PR req. #1). Make the Button itself at least 44×44, keep icon size consistent to avoid layout shift, and expose state via ARIA. Also wire aria-controls to the drawer.

Apply:

-            <Button
-              onPress={toggleMobileMenu}
-              className="bg-transparent text-slate-300 hover:bg-transparent hover:text-slate-100 focus:outline-none"
-            >
-              <span className="sr-only">Open main menu</span>
-              {mobileMenuOpen ? (
-                <FontAwesomeIcon icon={faTimes} className="h-8 w-8" />
-              ) : (
-                <FontAwesomeIcon icon={faBars} className="h-6 w-6" />
-              )}
+            <Button
+              onPress={toggleMobileMenu}
+              aria-label={mobileMenuOpen ? 'Close main menu' : 'Open main menu'}
+              aria-expanded={mobileMenuOpen}
+              aria-controls="mobile-menu-drawer"
+              className="h-11 w-11 shrink-0 rounded-md bg-transparent p-0 text-slate-300 hover:bg-transparent hover:text-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-owasp-blue dark:focus-visible:ring-offset-slate-800"
+            >
+              <span className="sr-only">{mobileMenuOpen ? 'Close main menu' : 'Open main menu'}</span>
+              {mobileMenuOpen ? (
+                <FontAwesomeIcon icon={faTimes} className="h-6 w-6" />
+              ) : (
+                <FontAwesomeIcon icon={faBars} className="h-6 w-6" />
+              )}

And on the drawer container:

-      <div
+      <div
+        id="mobile-menu-drawer"
         className={cn(

233-234: Brand capitalization: “GitHub”

Update the label to use the correct casing.

-              text="Star On Github"
+              text="Star on GitHub"
🧹 Nitpick comments (2)
frontend/src/components/Header.tsx (2)

189-194: Submenu spacing improvements look good; consider 44px target for submenu items

Nice use of gap/space-y and increased header padding. To better hit the 44px target on links themselves, consider bumping submenu item padding from py-2 to py-3 and adding focus-visible rings for keyboard users.

Example (for the Link at Line 199):

className={cn(
  'block w-full px-4 py-3 text-left text-sm text-slate-700 transition-colors duration-150 ease-in-out first:rounded-t-md last:rounded-b-md hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-700 dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-owasp-blue dark:focus-visible:ring-offset-slate-800',
  pathname === sub.href && 'bg-blue-50 font-medium text-blue-600 dark:bg-blue-900/20 dark:text-blue-200'
)}

25-53: Optional: add Escape-to-close and body scroll lock when drawer is open

Improves usability on iOS/Android and keyboard UX.

useEffect(() => {
  const handleResize = () => {
    if (window.innerWidth >= desktopViewMinWidth) setMobileMenuOpen(false)
  }
  const handleOutsideClick = (event: Event) => { /* unchanged */ }
  const handleKeyDown = (e: KeyboardEvent) => {
    if (e.key === 'Escape') setMobileMenuOpen(false)
  }

  // Lock scroll while open
  if (mobileMenuOpen) document.body.style.overflow = 'hidden'
  else document.body.style.overflow = ''

  window.addEventListener('resize', handleResize)
  window.addEventListener('click', handleOutsideClick)
  window.addEventListener('keydown', handleKeyDown)

  return () => {
    window.removeEventListener('resize', handleResize)
    window.removeEventListener('click', handleOutsideClick)
    window.removeEventListener('keydown', handleKeyDown)
    document.body.style.overflow = ''
  }
}, [mobileMenuOpen])
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2790353 and bf9a623.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx (4 hunks)
🔇 Additional comments (1)
frontend/src/components/Header.tsx (1)

156-160: LGTM: improved spacing in the mobile drawer header block

The added gap improves readability and separation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/components/Header.tsx (1)

134-141: Fix invalid Tailwind class, meet 44px tap target, add focus-visible ring + ARIA to the toggle

  • focus:outline-hidden isn’t a Tailwind class; use focus:outline-none.
  • Issue requires min 40×40 tap target; set the Button to 44×44 (h-11 w-11) and keep icon size modest.
  • Expose state to AT: add aria-controls/aria-expanded and make the sr-only label dynamic.

Apply:

-            <Button
-              onPress={toggleMobileMenu}
-              className="bg-transparent text-slate-300 hover:bg-transparent hover:text-slate-100 focus:outline-hidden"
-            >
-              <span className="sr-only">Open main menu</span>
+            <Button
+              onPress={toggleMobileMenu}
+              aria-controls="mobile-menu"
+              aria-expanded={mobileMenuOpen}
+              className="h-11 w-11 bg-transparent text-slate-300 hover:bg-transparent hover:text-slate-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-owasp-blue dark:focus-visible:ring-offset-slate-800"
+            >
+              <span className="sr-only">{mobileMenuOpen ? 'Close main menu' : 'Open main menu'}</span>

Outside this range, add an id to the panel so aria-controls resolves:

<div id="mobile-menu" className={cn(/* existing classes */)}>
♻️ Duplicate comments (1)
frontend/src/components/Header.tsx (1)

215-217: Adopt full-width 44px targets and focus-visible ring on mobile links (and thanks for fixing the dark:hover typo)

Previous comment about dark:hover::text-white is resolved. To further improve tap targets and keyboard focus:

-                    className={cn(
-                      'navlink dark:hover:text-white block px-3 py-2 text-slate-700 transition duration-150 ease-in-out hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-700',
+                    className={cn(
+                      'navlink block w-full h-11 px-4 text-left text-slate-700 transition-colors duration-150 ease-in-out hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-700 dark:hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:ring-offset-owasp-blue dark:focus-visible:ring-offset-slate-800',
                       pathname === link.href && 'font-bold text-blue-800 dark:text-white'
                     )}
+                    aria-current={pathname === link.href ? 'page' : undefined}
🧹 Nitpick comments (2)
frontend/src/components/Header.tsx (2)

195-206: Expose active state to screen readers on submenu items

Style already reflects active route; mirror it with aria-current for AT parity.

-                        <Link
+                        <Link
                           key={i}
                           href={sub.href || '/'}
+                          aria-current={pathname === sub.href ? 'page' : undefined}

233-234: Typo: “Github” → “GitHub”

Product name casing.

-              text="Star On Github"
+              text="Star on GitHub"
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dca4e7e and ae62ac8.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx (4 hunks)
🔇 Additional comments (2)
frontend/src/components/Header.tsx (2)

156-156: LGTM: Increased spacing around the mobile header/logo

gap-5 improves breathing room and touch ergonomics.


189-194: LGTM: Mobile submenu spacing improvements

gap-2, py-3, and space-y-4 make items more scannable and tappable.

Copy link

sonarqubecloud bot commented Sep 6, 2025

@kasya kasya added this pull request to the merge queue Sep 6, 2025
Merged via the queue into OWASP:main with commit 51962fa Sep 6, 2025
25 checks passed
Dishant1804 pushed a commit to Dishant1804/Nest that referenced this pull request Sep 6, 2025
* fix(ui): fixed usermenu styling on mobile screens

* fixed syntax issue

* Update styling

---------

Co-authored-by: Kate <[email protected]>
@ishanBahuguna ishanBahuguna deleted the feature/improve-user-navigation-menu-on-small-screens branch September 9, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(ui): improve mobile navigation menu usability
2 participants