Skip to content

Comments

fix: adjust navbar breakpoints to lg to prevent overflow #3272#3324

Merged
kasya merged 6 commits intoOWASP:mainfrom
harshita8120:fix/medium-screen-navbar-overflow-3272
Jan 17, 2026
Merged

fix: adjust navbar breakpoints to lg to prevent overflow #3272#3324
kasya merged 6 commits intoOWASP:mainfrom
harshita8120:fix/medium-screen-navbar-overflow-3272

Conversation

@harshita8120
Copy link
Contributor

Resolves #3272 - Fix navbar items overflow on medium screens

This PR addresses the issue where navbar items would overlap or become inaccessible on medium-sized screens (768px - 1024px). Earlier in the specified screen size range (768px - 1024px), the sign in and theme change buttons were inaccessible due to overflow of the items in the navbar.

Changes Made:

  • Updated the responsive breakpoints in "Header.tsx" from md to lg.

  • Screenshots for different screen sizes after the changes were made:

Screenshot (72) Screenshot (73) Screenshot (74)

Checklist

  • Required: I followed the contributing workflow
  • Required: I verified that my code works as intended and resolves the issue as described
  • Required: I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Summary by CodeRabbit

  • Responsive Design
    • Refined header breakpoints to optimize when navigation elements display across screen sizes.
    • Reorganized mobile menu toggle behavior for improved responsive layout.
    • Adjusted visibility of header controls for better presentation on medium and large screens.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The Header component's responsive breakpoints are adjusted, shifting desktop header links visibility from md (768px) to lg (1024px). The useIsMobile hook is removed, and mobile menu controls are repositioned via updated Tailwind classes. Related test file mocks are updated to accommodate multiple UserMenu instances.

Changes

Cohort / File(s) Summary
Header Component Responsive Updates
frontend/src/components/Header.tsx
Removes useIsMobile hook; shifts desktop header link breakpoint from md:block to lg:block; changes mobile menu toggle wrapper from md:hidden to lg:hidden; updates Star, Sponsor, and UserMenu visibility to show at md+ within md:flex containers; maintains layout structure with adjusted responsive windows.
Header Component Test Adjustments
frontend/__tests__/unit/pages/Header.test.tsx
Replaces static mock with dynamic mock for utils/constants; updates getByTestId to getAllByTestId for UserMenu queries to handle multiple instances; adjusts assertions to reference first UserMenu instance for data-github-auth validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • arkid15r
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 accurately summarizes the main change - adjusting navbar breakpoints from md to lg to fix overflow on medium screens, directly addressing issue #3272.
Description check ✅ Passed The description clearly relates to the changeset by explaining the navbar overflow issue, the breakpoint changes made, and including verification screenshots and checklist confirmations.
Linked Issues check ✅ Passed The PR successfully addresses issue #3272 by adjusting responsive breakpoints from md to lg in Header.tsx to prevent navbar item overflow on medium screens (768px-1024px).
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the navbar overflow issue: breakpoint adjustments in Header.tsx, aligned test updates, and related component adjustments stay within the issue's scope.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

🤖 Fix all issues with AI agents
In @frontend/src/components/Header.tsx:
- Line 61: The breakpoint constant desktopViewMinWidth is still 768 causing JS
to mismatch the CSS lg breakpoint; update desktopViewMinWidth from 768 to 1024
in frontend/src/utils/constants.ts, ensure the useIsMobile hook (which reads
desktopViewMinWidth) will now treat widths <1024 as mobile, and adjust the
Header.tsx handleResize logic (and any checks referencing desktopViewMinWidth or
directly using 768 in Header.tsx) so the mobile menu closes at >=1024; also
update the unit test mock in frontend/__tests__/unit/pages/Header.test.tsx to
use 1024 instead of 768 so tests reflect the new breakpoint.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42459af and 73c025a.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx

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: 0

🧹 Nitpick comments (1)
frontend/__tests__/unit/pages/Header.test.tsx (1)

107-130: LGTM! Mock value correctly synchronized with the updated constant.

The mock value desktopViewMinWidth: 1024 matches the actual constant in constants.ts.

Consider importing the actual constant instead of hardcoding the value in the mock. This would prevent the values from drifting out of sync in future updates:

♻️ Suggested improvement
+import { desktopViewMinWidth, headerLinks } from 'utils/constants'
+
 // Mock constants
-jest.mock('utils/constants', () => ({
-  desktopViewMinWidth: 1024,
-  headerLinks: [
+jest.mock('utils/constants', () => {
+  const actual = jest.requireActual('utils/constants')
+  return {
+    ...actual,
     // Override only if needed for specific test scenarios
-    ...
-  ],
-}))
+  }
+})

Alternatively, if the full mock is intentional for test isolation, the current approach is acceptable.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73c025a and 1846885.

📒 Files selected for processing (2)
  • frontend/__tests__/unit/pages/Header.test.tsx
  • frontend/src/utils/constants.ts
🔇 Additional comments (2)
frontend/__tests__/unit/pages/Header.test.tsx (1)

191-207: Consistent test setup with the new breakpoint.

The globalThis.innerWidth value of 1024 on line 198 correctly aligns with the updated desktopViewMinWidth constant, ensuring tests run at the desktop view threshold.

frontend/src/utils/constants.ts (1)

125-125: Breakpoint constant correctly aligned with Tailwind's lg breakpoint.

The change to 1024 consistently applies across the codebase:

  • JS constant matches Tailwind's lg breakpoint
  • CSS classes properly updated (lg:block, lg:table-cell, etc.)
  • Test mocks synchronized to 1024
  • All usages (Header resize handler, useIsMobile hook) operate correctly with the new value

@harshita8120
Copy link
Contributor Author

Thank you for the suggestion! I've synchronized the hardcoded values to 1024 across the constants and tests to ensure consistency, but I’m choosing to keep the code simple and consistent with how the rest of the project is written.

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

@harshita8120 hi! Thanks for working on this! Left a question/request.
Also, please resolve CodeRabbit comment.

Also please run make check-test and address found issues before pushing to remote - you haven't done that this time.

Copy link
Collaborator

@kasya kasya Jan 16, 2026

Choose a reason for hiding this comment

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

This works good overall 👍🏼

One thing I noticed is that when we are at a 1024 and collaps some of the menus - the buttons are now still showing in the Header until 768 breakpoint. However, we also have them in the menu on the side. This causes Star and Sponsor buttons to show up in both places.

Do you think you can update that?

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sure, I'll shortly update this.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 16, 2026
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

🤖 Fix all issues with AI agents
In `@frontend/__tests__/unit/pages/Header.test.tsx`:
- Around line 106-126: Remove the duplicate "// Mock constants" comment and
replace the vague "// Matches your logic" with a clearer note describing the
breakpoint; update the jest.mock block that overrides utils/constants (the
desktopViewMinWidth and headerLinks mock) to have a single "// Mock constants"
header and change the desktopViewMinWidth inline comment to something like "//
Updated breakpoint threshold for lg screens" so the purpose is explicit.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 16, 2026
@harshita8120 harshita8120 requested a review from kasya January 16, 2026 23:12
@sonarqubecloud
Copy link

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: 0

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)

27-32: Update desktopViewMinWidth from 768 to 1024 in frontend/src/utils/constants.ts.

The resize handler closes the mobile menu when innerWidth >= desktopViewMinWidth, but the constant is currently set to 768. This creates a mismatch: the mobile menu closes at 768px while the menu toggle button remains visible until 1024px (the lg CSS breakpoint). Update the constant to 1024 to ensure consistency across all breakpoint logic.

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

@harshita8120 thanks for working on this!

I pushed a little change to update how we show buttons: we'll show them only on the top header until 768px width, then move to the sidebar 👌🏼

Image Image

@kasya kasya enabled auto-merge January 17, 2026 22:38
@kasya kasya mentioned this pull request Jan 17, 2026
@kasya kasya added this pull request to the merge queue Jan 17, 2026
Merged via the queue into OWASP:main with commit 29cfd17 Jan 17, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hidden parts of the navbar on the screens of medium screens

2 participants