Skip to content

fix: enable theme toggle functionality on 403 and 405 pages#821

Open
Monica-CodingWorld wants to merge 1 commit into
komalharshita:mainfrom
Monica-CodingWorld:fix-theme-toggle-functionality
Open

fix: enable theme toggle functionality on 403 and 405 pages#821
Monica-CodingWorld wants to merge 1 commit into
komalharshita:mainfrom
Monica-CodingWorld:fix-theme-toggle-functionality

Conversation

@Monica-CodingWorld

@Monica-CodingWorld Monica-CodingWorld commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary [required]

This PR fixes the theme toggle functionality on the 403 and 405 error pages. Although the theme toggle UI was already present on these pages, it was non-functional because the required JavaScript file (static/script.js) was not being loaded. While implementing the fix, I also identified and corrected a JavaScript syntax error in static/script.js that prevented the script from parsing correctly. As a result, theme initialization and theme switching now work consistently across all error pages (403, 404, 405, and 500).

Related Issue [required]

Closes #819

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
templates/403.html Added static/script.js so theme initialization and toggle functionality are available on the 403 page
templates/405.html Added static/script.js so theme initialization and toggle functionality are available on the 405 page
static/script.js Fixed a missing closing brace in createTag() which caused a JavaScript syntax error and prevented the script from executing correctly

How to Test This PR [required]

  1. Clone this branch:
    git checkout fix-theme-toggle-functionality
  2. Install dependencies:
    pip install -r requirements.txt
  3. Run the application:
    python app.py
  4. Open the following pages:
  1. Click the theme toggle button.
  2. Verify that the theme switches between light and dark modes.
  3. Open browser developer tools and confirm there are no JavaScript syntax errors in the console.

Expected test output:


- Theme toggle works correctly on both 403 and 405 pages.
- Theme preference is applied consistently.
- No JavaScript syntax errors appear in the browser console.

Test Results [required]

node --check static/script.js

Output:

(no output)

This confirms the JavaScript file parses successfully without syntax errors.

Screenshots (if UI change)

Before After

|
WhatsApp Image 2026-06-09 at 11 21 34 AM
|
image
|

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 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
  • 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 investigating why the theme toggle was not functioning on the 403 and 405 pages, I discovered a JavaScript syntax error in static/script.js caused by a missing closing brace. Fixing this issue was necessary to ensure the script could execute correctly and enable theme functionality on the affected pages.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@Monica-CodingWorld 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.

@Monica-CodingWorld

Copy link
Copy Markdown
Contributor Author

Hi @komalharshita
While testing this issue, I discovered a pre-existing JavaScript syntax error in static/script.js caused by a missing closing brace in createTag(). Because the browser could not parse the script successfully, JavaScript execution was interrupted, affecting functionality that depends on script.js, including theme-related behavior. Since script.js is loaded across multiple pages, the parsing failure could prevent other JavaScript-driven functionality from executing correctly. I fixed this syntax error as part of the PR since it was necessary to ensure the theme toggle could function correctly on the 403 and 405 pages.

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.

Theme toggle on 403 and 405 error pages is visible but non-functional

1 participant