Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Inline onclick handlers violate Content Security Policy best practices and reduce maintainability. This PR moves all event handlers to proper event listeners in the respective JavaScript modules.

Changes

  • HTML files (books.html, index.html): Removed onclick attributes from menu and theme toggle buttons
  • menu.js: Attached click listener via btn.addEventListener('click', toggleMenu) in DOMContentLoaded
  • theme.js: Attached click listener via btn.addEventListener('click', toggleTheme) in DOMContentLoaded

Before:

<button class="menu-button" onclick="toggleMenu()" aria-label="Menu">

After:

<button class="menu-button" aria-label="Menu">
// In menu.js DOMContentLoaded handler
btn.addEventListener('click', toggleMenu);

Testing

Functionality verified - menu and theme toggle working correctly


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: arjun7965 <15646612+arjun7965@users.noreply.github.com>
Copilot AI changed the title [WIP] Update enhancements for dark mode and books page Remove inline event handlers for CSP compliance Nov 14, 2025
Copilot AI requested a review from arjun7965 November 14, 2025 06:18
@arjun7965 arjun7965 marked this pull request as ready for review November 14, 2025 06:19
@arjun7965 arjun7965 merged commit 1a0131a into basic_html Nov 14, 2025
@arjun7965 arjun7965 deleted the copilot/sub-pr-1-again branch November 14, 2025 06:19
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