Skip to content

fix: add theme support to 403 and 405 pages#788

Open
Monica-CodingWorld wants to merge 1 commit into
komalharshita:mainfrom
Monica-CodingWorld:fix-403-405-theme
Open

fix: add theme support to 403 and 405 pages#788
Monica-CodingWorld wants to merge 1 commit into
komalharshita:mainfrom
Monica-CodingWorld:fix-403-405-theme

Conversation

@Monica-CodingWorld
Copy link
Copy Markdown

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

Summary [required]

This PR fixes theme support inconsistencies on the 403 (Forbidden) and 405 (Method Not Allowed) error pages. Both templates were missing the theme_head.html partial responsible for applying the saved theme before rendering, which could result in a Flash of Unstyled Content (FOUC) for users with dark mode enabled. They were also missing the theme toggle button available on other error pages, preventing users from switching themes from these pages.

Related Issue [required]

Closes #756

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 partials/theme_head.html and partials/theme_toggle.html includes
templates/405.html Added partials/theme_head.html and partials/theme_toggle.html includes

How to Test This PR [required]

  1. Clone this branch:
  2. git checkout fix-403-405-theme
  3. Install dependencies:
  • pip install -r requirements.txt
  1. Run the application.
  2. Navigate to the 403 error page.
  3. Verify that:
  • The page loads with the correct saved theme applied.
  • No light-theme flash occurs for dark-mode users.
  • The theme toggle button is visible and functional.
  1. Navigate to the 405 error page.
  2. Verify the same behavior as above.

Expected test output:

Not applicable - template-only change.

Test Results [required]

paste output here

Screenshots (if UI change)

Before After

|
image
|
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 working on this issue, I noticed that templates/500.html currently contains the theme toggle include but does not contain partials/theme_head.html. I left it unchanged to keep this PR strictly scoped to the reported issue affecting 403.html and 405.html.
also
This PR addresses the reported issue by adding the missing theme_head.html and theme_toggle.html includes to the 403 and 405 error pages so they match the other error templates.

During testing I also noticed that theme switching functionality is not active on these pages because script.js is not loaded in 403.html and 405.html. I did not modify that behavior because it was outside the scope of the issue, but I'm happy to add it if maintainers would like the toggle to be fully functional.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 7, 2026

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

Copy link
Copy Markdown

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

@Monica-CodingWorld Monica-CodingWorld marked this pull request as ready for review June 7, 2026 07:36
@Monica-CodingWorld
Copy link
Copy Markdown
Author

Hi @komalharshita
This PR addresses the reported issue by adding the missing theme_head.html and theme_toggle.html includes to the 403 and 405 error pages so they match the other error templates.

During testing I also noticed that theme switching functionality is not active on these pages because script.js is not loaded in 403.html and 405.html. I did not modify that behavior because it was outside the scope of the issue, but I'm happy to add it if maintainers would like the toggle to be fully functional.

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] 403 and 405 error pages lack dark mode theme support causing FOUC

1 participant