Skip to content

🎨 Palette: Prevent page scrolling when playing Mario game#110

Open
EiJackGH wants to merge 1 commit intomainfrom
palette/mario-game-scrolling-fix-5245249649879977107
Open

🎨 Palette: Prevent page scrolling when playing Mario game#110
EiJackGH wants to merge 1 commit intomainfrom
palette/mario-game-scrolling-fix-5245249649879977107

Conversation

@EiJackGH
Copy link
Owner

💡 What

Updated the mario-game.njk view to call e.preventDefault() on game-related keypresses (Space, Arrow keys). I also restricted the jump action to specifically "Space" or "ArrowUp", rather than any keypress.

🎯 Why

Browsers natively interpret Space and Arrow keys as commands to scroll the page. When playing a browser-based game, this creates a frustrating user experience where the entire game container jumps up and down while the user is trying to play. Additionally, jumping when a user pressed an unrelated key (like 'A' or 'Shift') felt unpolished.

📸 Before/After

(Visuals remain identical, interaction is what changed.)

  • Before: Pressing Space would jump Mario AND scroll the page down if the window wasn't perfectly sized. Pressing "A" would jump Mario.
  • After: Pressing Space/Arrow keys only affects the game, preventing annoying scrolling. Jumping is restricted to proper jump keys.

♿ Accessibility

Keyboard players can now reliably use the game without interfering with their broader browser viewport or triggering unintended page navigation.


PR created automatically by Jules for task 5245249649879977107 started by @EiJackGH

Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@EiJackGH EiJackGH deployed to production March 23, 2026 13:59 — with GitHub Actions Active
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.

1 participant