Skip to content

fix: add missing theme toggle button to homepage navbar - #1079

Merged
komalharshita merged 2 commits into
komalharshita:mainfrom
HarshalKushwaha0027:fix/homepage-theme-toggle
Jul 18, 2026
Merged

fix: add missing theme toggle button to homepage navbar#1079
komalharshita merged 2 commits into
komalharshita:mainfrom
HarshalKushwaha0027:fix/homepage-theme-toggle

Conversation

@HarshalKushwaha0027

Copy link
Copy Markdown
Contributor

Summary

The homepage (index.html) navbar was missing the theme toggle button that already
exists on the project detail page (project.html). Users had no way to switch between
light and dark mode from the homepage without opening the mobile menu. This PR adds the
theme toggle to the desktop navbar on the homepage, matching the behaviour already present
on all other pages. It also fixes a pre-existing HTML bug where the navbar search form
was incorrectly closed with </div> instead of </form>, causing invalid DOM structure.

Related Issue

Closes #1037

Type of Change

  • Bug fix — resolves a broken behaviour
  • Style — CSS or visual changes only, no logic change

What Was Changed

File Change made
src/templates/index.html Fixed </div></form> closing tag bug on navbar search form; added nav-right div containing desktop nav links and theme toggle via {% include 'partials/theme_toggle.html' %}

How to Test This PR

  1. Clone this branch: git checkout fix/homepage-theme-toggle
  2. Install dependencies: pip install -r requirements.txt
  3. Run the app: cd src && python app.py
  4. Open http://127.0.0.1:5000
  5. On desktop (≥ 769px width), confirm the theme toggle button is visible in the top-right navbar
  6. Click the toggle and confirm the page switches between light and dark mode
  7. Reload the page and confirm the selected theme persists
  8. Shrink the browser to mobile width (< 768px) and confirm the mobile menu toggle still works as before
  9. Run the tests: python tests/test_basic.py

Expected test output:

Test Results

77 passed, 1 failed out of 78 tests

Screenshots

| Before | After |
|
image
|
image
|
| No theme toggle visible in homepage navbar | Theme toggle button visible in top-right of homepage navbar |

Self-Review Checklist

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows the convention: fix/homepage-theme-toggle
  • I have run python tests/test_basic.py and all 27 tests pass
  • 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 — N/A, no new functions added
  • 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 — N/A

Notes for Reviewer

  • No changes were made to style.css or script.js — the existing CSS classes
    (.theme-toggle, .icon-moon, .icon-sun) and JS initialization for id="theme-toggle"
    already handled this case; only the HTML was missing.
  • The {% include 'partials/theme_toggle.html' %} pattern is identical to what
    project.html already uses, so no new partial was created.
  • The </div></form> fix is a bonus bug fix discovered while working on this issue.

@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

@HarshalKushwaha0027 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.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels Jun 21, 2026

@github-actions github-actions 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.

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@komalharshita

Copy link
Copy Markdown
Owner

@HarshalKushwaha0027 kindly resolve the merge conflicts

@komalharshita komalharshita added the need review Further information is requested label Jul 15, 2026
@komalharshita
komalharshita merged commit 5f6d509 into komalharshita:main Jul 18, 2026
4 of 5 checks passed
@komalharshita

Copy link
Copy Markdown
Owner

Thank you for taking the time to contribute to DevPath and for working on this usability improvement! Your effort in identifying and fixing the missing theme toggle on the homepage helps make the user experience more consistent across the application.

I also appreciate that you fixed the incorrect HTML closing tag while implementing the feature. Addressing the DOM structure issue alongside the theme toggle keeps the codebase cleaner and prevents potential rendering issues.

The implementation is focused, well-scoped, and includes clear testing steps to verify both desktop and mobile behavior. This change improves accessibility and ensures users can switch themes directly from the homepage, matching the experience on other pages.

Great work, and thank you again for investing your time and effort into improving DevPath.
Your contribution is much appreciated! 🚀

Approved for merge. ✅

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]: Theme toggle missing from homescreen navbar

2 participants