Skip to content

Conversation

@Mrprey
Copy link
Collaborator

@Mrprey Mrprey commented Oct 13, 2025

Description ✍️

This Pull Request improves the UX of PlutoGrid by ensuring that when a user taps a cell, the grid automatically scrolls to bring the selected cell into view — both vertically and horizontally. This eliminates the need for manual scrolling when interacting with off-screen cells.

Key Changes:

  • Introduced _ensureCellVisibility() method in PlutoGridCellGestureEvent to centralize scroll logic.
  • Ensures both row and column visibility using precise offset calculations based on viewport size and scroll extents.
  • Updates gesture handlers (onTapUp, onLongPressStart) to trigger visibility adjustments when a cell is selected or edited.
  • Added comprehensive unit tests to verify behavior under various scroll conditions.

Overview 👀

✅ Before

  • Tapping a cell outside of the viewport didn’t automatically scroll to it.
  • Users had to manually scroll to bring selected cells into view.

✅ After

  • Grid now scrolls both vertically and horizontally to reveal the selected cell.
  • Behavior works for both selecting and editing states.

Visual Example (not included, optional):

Imagine tapping a cell far to the right — the grid auto-scrolls to bring it into view.

How to Smoke? 👷‍♂️

  1. Open a PlutoGrid with multiple rows and columns, enough to require scrolling.
  2. Scroll to hide part of the grid (e.g., scroll down and right).
  3. Tap a cell that is not currently visible.
  4. ✅ Confirm:
    • The grid scrolls to bring the tapped cell into view.
    • The cell enters editing mode (if expected).
  5. Run unit tests:
    flutter test test/src/manager/event/pluto_grid_cell_gesture_event_test.dart

6.Pay special attention to:

  • should reposition vertical scroll when tapped row is above viewport
  • should reposition horizontal scroll when tapped column is clipped

@Mrprey Mrprey self-assigned this Oct 13, 2025
@Mrprey Mrprey added the bug Something isn't working label Oct 13, 2025
@Mrprey Mrprey changed the title Ensure mouse focus scrolls cell into view DIGIT-2432 Ensure mouse focus scrolls cell into view Oct 13, 2025
@Mrprey Mrprey requested review from Leonardo1952 and rodiguif and removed request for Leonardo1952 October 13, 2025 13:28
Copy link
Collaborator

@rodiguif rodiguif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
The behavior is perfect.

@rodiguif rodiguif merged commit 13f8669 into master Oct 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants