Repository navigation
Conversation
Grid jump scrolling updated scroll position and focused index without requesting focus on the target card. Invalidate item details when focused index changes and request focus once the target card is composed so D-pad navigation continues from it. Assisted-by: agy:gemini-3.8-flash-high
bonfiglioalessio
added a commit
to bonfiglioalessio/Nigiro
that referenced
this pull request
Nov 13, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In
CardGrid, using Page Up / Page Down or remote jump buttons (fast-forward / rewind) scrolls the grid to the target position, but focus does not transfer to the target card. BecausecurrentFocusedIndexwas not included in therememberkeys forGridItemDetails, item focus modifiers were not updated when the jump target changed, and programmatic focus was never requested on the target card after jump scrolling. Consequently, focus remained on the old item (or was lost when it scrolled off-screen), and subsequent D-pad navigation continued from the old card rather than the target card.This PR adds
currentFocusedIndexto therememberkeys inCardGridso item modifiers update when the focused index changes, and requests focus viafirstFocusonce the target card is composed after a jump.Related issues
I searched existing issues and pull requests on
damontecres/Wholphinfor Page Up/Down and grid jump focus and did not find an existing issue or pull request for this behavior.Steps to reproduce:
Testing
TestGridPageKeys(pageDownTransfersFocusToTargetCard) verifies that pressing Page Down transfers focus to the target card and subsequent D-pad Down navigation continues from that target card. The test fails on the unfixed code and passes with this fix.Screenshots
None (no UI change).
AI or LLM usage
I used AI tools for this change: Codex found the bug and wrote an earlier version of the fix, Google Gemini drafted this commit and test, and Claude assisted with planning and review. This covers the changes in
CardGrid.ktandTestGridPageKeys.kt.I tested the change with the unit test above and ktlint. I have reviewed and understand the changes in this pull request and take responsibility for them.