Skip to content

Fix/mobile menu resize bug#455

Merged
komalharshita merged 2 commits into
komalharshita:mainfrom
pari-dubey1:fix/mobile-menu-resize-bug
Jun 3, 2026
Merged

Fix/mobile menu resize bug#455
komalharshita merged 2 commits into
komalharshita:mainfrom
pari-dubey1:fix/mobile-menu-resize-bug

Conversation

@pari-dubey1
Copy link
Copy Markdown
Contributor

Summary [required]

This PR fixes a responsive navigation issue where the mobile hamburger menu remained open when resizing the browser window from mobile view to desktop view. This caused both the mobile and desktop navigation menus to appear simultaneously.

The fix adds a resize listener that automatically closes and resets the mobile navigation state once the viewport crosses the desktop breakpoint, ensuring consistent responsive behaviour across screen sizes.

Additionally, while testing and debugging the issue, several unintended JavaScript syntax and duplicated logic issues in script.js were identified and cleaned up to restore proper functionality of the navbar and overall client-side interactions.


Related Issue [required]

Closes #285


Type of Change [required]

  • Bug fix — resolves a broken behaviour
  • Feature — adds new functionality
  • Data — adds new projects to data/projects.json
  • Documentation — updates docs, README, or code comments only
  • Style — CSS or visual changes only, no logic change
  • Refactor — restructures code without changing behaviour
  • Test — adds or updates tests

What Was Changed [required]

File Change made
static/js/script.js Added resize event listener to automatically close mobile navbar on desktop resize
static/js/script.js Removed duplicated form submission blocks causing JavaScript parsing issues
static/js/script.js Cleaned duplicated renderResults() conditional logic
static/js/script.js Fixed broken/mismatched braces and syntax issues preventing navbar functionality

How to Test This PR [required]

  1. Clone this branch:

    git checkout fix/mobile-menu-resize-bug
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the app:

    python app.py
  4. Open:

    http://127.0.0.1:5000
    
  5. Open browser responsive/mobile mode

  6. Set viewport to mobile width

  7. Open the hamburger menu

  8. Resize the browser window to desktop width

  9. Verify that:

    • the mobile menu automatically closes
    • only the desktop navbar remains visible
    • no duplicate navigation menus appear
  10. Run tests:

python tests/test_basic.py

Expected result:

All tests should pass successfully.

Test Results [required]

paste output here

Screenrecording

Screen.Recording.2026-05-22.144304.mp4

Self-Review Checklist [required]

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: feat/, fix/, docs/, data/, style/, test/
  • I have run python tests/test_basic.py
  • I have run flake8 . locally and there are no errors
  • I have not introduced any print() or console.log() debug statements
  • Every new function I wrote has a docstring
  • I have not modified files outside the scope of the linked issue
  • If I changed the UI, I tested it at 375px (mobile) and 1280px (desktop)
  • If I added a project to the dataset, it has all required JSON fields

Notes for Reviewer

While implementing the responsive navbar fix, some pre-existing duplicated JavaScript blocks and syntax inconsistencies in script.js were discovered that prevented the navbar interactions from functioning correctly. These were cleaned up to restore stable client-side behaviour and ensure accurate testing of the assigned issue.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@pari-dubey1 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@pari-dubey1
Copy link
Copy Markdown
Contributor Author

@komalharshita Please review my PRs (#282 , #455 , #458 ). Thank you!

Copy link
Copy Markdown
Owner

@komalharshita komalharshita left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution.

The mobile menu resize fix itself looks reasonable and directly addresses the issue where the mobile navigation remains open after resizing to desktop view.

However, this PR also includes multiple unrelated changes to the recommendation form submission flow, API error handling, and results rendering logic. These modifications are outside the scope of the reported mobile menu resize issue and make the PR much larger than necessary.

In addition, the PR currently has merge conflicts that must be resolved before it can be reviewed for merge.

Please keep this PR focused only on the mobile menu resize fix, remove the unrelated recommendation-system changes, rebase against the latest main branch, and resolve all merge conflicts.

Requested changes.

@komalharshita komalharshita added need review Further information is requested level:beginner quality:clean labels Jun 2, 2026
@pari-dubey1 pari-dubey1 force-pushed the fix/mobile-menu-resize-bug branch from 9a11397 to c23ee32 Compare June 3, 2026 09:38
@pari-dubey1 pari-dubey1 force-pushed the fix/mobile-menu-resize-bug branch from c23ee32 to 6584be5 Compare June 3, 2026 10:02
@pari-dubey1
Copy link
Copy Markdown
Contributor Author

Thank you for the contribution.

The mobile menu resize fix itself looks reasonable and directly addresses the issue where the mobile navigation remains open after resizing to desktop view.

However, this PR also includes multiple unrelated changes to the recommendation form submission flow, API error handling, and results rendering logic. These modifications are outside the scope of the reported mobile menu resize issue and make the PR much larger than necessary.

In addition, the PR currently has merge conflicts that must be resolved before it can be reviewed for merge.

Please keep this PR focused only on the mobile menu resize fix, remove the unrelated recommendation-system changes, rebase against the latest main branch, and resolve all merge conflicts.

Requested changes.

i have done the changes. please review the PR.

@komalharshita komalharshita merged commit 9a8a1a3 into komalharshita:main Jun 3, 2026
7 of 8 checks passed
@komalharshita
Copy link
Copy Markdown
Owner

Looks good....approved for merge!

@komalharshita komalharshita added gssoc:approved and removed need review Further information is requested labels Jun 3, 2026
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.

[Bug]: Mobile Hamburger Menu Does Not Close After Resizing to Desktop View

2 participants