Skip to content

fix: resolve theme toggle issues across web and legacy generators#734

Closed
devprakash93 wants to merge 1 commit intonodejs:mainfrom
devprakash93:fix/theme-toggle-not-working
Closed

fix: resolve theme toggle issues across web and legacy generators#734
devprakash93 wants to merge 1 commit intonodejs:mainfrom
devprakash93:fix/theme-toggle-not-working

Conversation

@devprakash93
Copy link
Copy Markdown

@devprakash93 devprakash93 commented Mar 30, 2026

Description

Resolves "Theme Toggle Not Working" issues reported across both the Web and Legacy generators, caused by two separate regressions:

  1. Web Generator (Safari / General)
    The @node-core/ui-components/Common/ThemeToggle component recently updated from a binary toggle to a 3-state dropdown (light, dark, system). NavBar.jsx and useTheme.mjs were still using an <button onClick> approach rather than the new onChange(theme) prop. This caused clicking the button to blindly cycle themes and immediately close the dropdown while rejecting the "system" state.
  • Fix: Updated useTheme.mjs to export a changeTheme(newTheme) callback instead of toggleTheme(). Updated NavBar.jsx to pass the correct onChange and currentTheme props.
  1. Legacy Generator (Firefox)
    In the legacy HTML generated pages, clicking the theme toggle wasn't working specifically on Firefox. The click specifically on the inner SVG icons was failing to bubble optimally to the <button> event listener.
  • Fix: Added pointer-events: none to the .theme-toggle-btn svg in style.css so clicks correctly tunnel straight to the <button> element. Also added type="button" defensively to avoid unintended form-submission behaviors.

Validation

  • Verified Web Generator ThemeToggle correctly sends the chosen state (light, dark, system) through onChange to useTheme.
  • Verified pointer-events: none logic for SVGs enforces native <button> click handling consistently across Firefox.
  • Local tests pass successfully (npm run test).

Related Issues

Fixes Theme Toggle Not Working.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format & node --run lint.
  • I've covered new added functionality with unit tests if necessary. (N/A - UI layout changes)

@devprakash93 devprakash93 requested a review from a team as a code owner March 30, 2026 19:35
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Mar 30, 2026 7:36pm

Request Review

@avivkeller
Copy link
Copy Markdown
Member

Duplicate of an already open PR.

@avivkeller avivkeller closed this Mar 30, 2026
@araujogui
Copy link
Copy Markdown
Member

Thanks for your PR @devprakash93. Unfortunately, it's already been tackled here: #656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants