Skip to content

Conversation

@Nl-T-lN
Copy link
Contributor

@Nl-T-lN Nl-T-lN commented Oct 23, 2025

bug: When using the website on mobile devices audio mute button and theme changing button weren't working

Fix: Enable Button Clicks on Mobile Devices

Description

This PR fixes a bug where UI buttons didn’t respond to taps on touch devices (phones/tablets).
Affected elements:

  • Mute button
  • Theme buttons (Default, Night, Sunset)
  • “Close Results” button on Game Over modal

Root Cause

In script.js, a global touchstart listener used e.preventDefault() on every tap to control the game.
On mobile browsers, this prevented click events from firing, breaking button interactivity.

Fix

Updated the window.addEventListener("touchstart", ...) handler:

✅ Checklist (Tested on Mobile / Touch Device)

  • Mute Button toggles sound correctly.
  • Theme Buttons change themes as expected.
  • Close Results button closes modal.
  • Game Controls (taps) still work normally.
  • No accidental block placement when tapping buttons.

Closes: #66

Inital bug where when clicking on the buttons it restarts the game

error.mp4

Buttons are fixed in new update

fix.mp4

@vercel
Copy link

vercel bot commented Oct 23, 2025

@Nl-T-lN is attempting to deploy a commit to the Maitri Vaghasiya's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 24, 2025

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

Project Deployment Preview Comments Updated (UTC)
3d-blockstack Ready Ready Preview Comment Oct 24, 2025 5:44am

@maitri-vv maitri-vv added the hacktoberfest Hacktoberfest2025 label Oct 24, 2025
@maitri-vv maitri-vv merged commit 0c8f06b into maitri-vv:main Oct 24, 2025
2 of 3 checks passed
@Nl-T-lN Nl-T-lN changed the title button control fixed for mobile and touchscreen devicesf button control fixed for mobile and touchscreen devices Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest Hacktoberfest2025

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants