Skip to content

Fix theme toggle conflicts from duplicate script inclusion and overlapping listeners#76

Open
linseyqiu-hub wants to merge 1 commit into
brgkdm:mainfrom
linseyqiu-hub:linseyQFeatures
Open

Fix theme toggle conflicts from duplicate script inclusion and overlapping listeners#76
linseyqiu-hub wants to merge 1 commit into
brgkdm:mainfrom
linseyqiu-hub:linseyQFeatures

Conversation

@linseyqiu-hub

Copy link
Copy Markdown

The theme toggle button malfunction was caused by duplicate script loading and competing event listeners.

Issues identified:

theme-toggle.js was included twice in index.html (line 132 and line 245), resulting in duplicate DOMContentLoaded handlers and click listeners being registered

Both script.js and theme-toggle.js attached click listeners to the theme toggle button, creating overlapping behavior and inconsistent state changes

The duplicated listeners obscured the root cause and made debugging confusing

Changes made:

Commented out the duplicate <script src="js/theme-toggle.js"></script> at index.html:132, keeping the intended include at line 245

Removed the redundant theme toggle click listener from script.js

Refactored theme-toggle.js so theme toggling is handled exclusively by a single, centralized event listener

This eliminates duplicate execution, clarifies ownership of theme logic, and restores predictable toggle behavior.

Fix theme toggle conflicts from duplicate script inclusion and overlapping listeners

Body

The theme toggle button malfunction was caused by duplicate script loading and competing event listeners.

Issues identified:

theme-toggle.js was included twice in index.html (line 132 and line 245), resulting in duplicate DOMContentLoaded handlers and click listeners being registered

Both script.js and theme-toggle.js attached click listeners to the theme toggle button, creating overlapping behavior and inconsistent state changes

The duplicated listeners obscured the root cause and made debugging confusing

Changes made:

Commented out the duplicate <script src="js/theme-toggle.js"></script> at index.html:132, keeping the intended include at line 245

Removed the redundant theme toggle click listener from script.js

Refactored theme-toggle.js so theme toggling is handled exclusively by a single, centralized event listener

This eliminates duplicate execution, clarifies ownership of theme logic, and restores predictable toggle behavior.
@brgkdm

brgkdm commented Mar 14, 2026

Copy link
Copy Markdown
Owner

Resolve Conflicts

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.

2 participants