From 31098d7fbfaffdcbe70ab5b0b2ecb8a1517fb9c7 Mon Sep 17 00:00:00 2001 From: "posthog[bot]" <206114724+posthog[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 09:38:22 +0000 Subject: [PATCH] fix(paddle-card): release nav buttons outside active play so users can exit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PaddleCard::handleButtonPress consumed BUTTON_UP and BUTTON_DOWN whenever the game was in StartScreen, Playing, Paused, or ServeDelay state, swallowing the events before CardNavigationStack could use them to scroll to another card. This trapped the user inside the game once it started — they could not navigate away, which a user reported as being "stuck". Mirror the FlappyHogCard pattern: only consume Up/Down while the game is actively being played (GameState::Playing, where they drive the paddle). In every other state let Up/Down fall through to CardNavigationStack so the user can always exit. Center remains owned by PaddleCard for start/pause/resume/ restart; navigation never uses center, so consuming it is safe. Introduced in c88bd01 (Paddle IP compliance pass). Generated-By: PostHog Code Task-Id: bb75f66f-cae8-440b-8de6-61a727af6754 --- src/ui/PaddleCard.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/ui/PaddleCard.cpp b/src/ui/PaddleCard.cpp index 56cb99e..1e6fb05 100644 --- a/src/ui/PaddleCard.cpp +++ b/src/ui/PaddleCard.cpp @@ -230,25 +230,23 @@ void PaddleCard::updateMessageLabel() { bool PaddleCard::handleButtonPress(uint8_t button_index) { PaddleGame::GameState current_game_state = _paddle_game_instance.getState(); - if (current_game_state == PaddleGame::GameState::GameOver || - current_game_state == PaddleGame::GameState::StartScreen) { - // In GameOver state: - // - Center button is still handled by PaddleCard (to restart) - // - Up/Down buttons are NOT handled, allowing CardNavigationStack to use them - if (button_index == Input::BUTTON_CENTER) { - return true; // Center press restarts the game (handled in update()) - } - return false; // Up/Down presses are not handled by PaddleCard in GameOver - } else { - // In other states (StartScreen, Playing, Paused): - // PaddleCard handles all three relevant buttons - if (button_index == Input::BUTTON_CENTER || - button_index == Input::BUTTON_UP || - button_index == Input::BUTTON_DOWN) { - return true; // Event handled by PaddleCard (logic is in update()) - } + // Center is always owned by PaddleCard: it starts, pauses, resumes, or + // restarts the game depending on the current state (handled in update()). + // Navigation never uses center, so consuming it here is safe. + if (button_index == Input::BUTTON_CENTER) { + return true; } - return false; // Other buttons or unhandled cases + + // Up/Down only drive the paddle while the game is actively being played. + // In every other state (StartScreen, Paused, ServeDelay, GameOver) we must + // let them fall through to CardNavigationStack so the user can always scroll + // to another card and exit the game instead of getting stuck. + if (current_game_state == PaddleGame::GameState::Playing && + (button_index == Input::BUTTON_UP || button_index == Input::BUTTON_DOWN)) { + return true; // Event handled by PaddleCard (paddle movement logic is in update()) + } + + return false; // Let CardNavigationStack handle Up/Down for navigation } lv_obj_t* PaddleCard::getCard() const {