Skip to content

Clamp sub-column offset in horizontal scrolling to prevent overflow a… - #1463

Open
Stelinkaa wants to merge 1 commit into
masterfrom
feature/horizontal-scroll
Open

Clamp sub-column offset in horizontal scrolling to prevent overflow a…#1463
Stelinkaa wants to merge 1 commit into
masterfrom
feature/horizontal-scroll

Conversation

@Stelinkaa

Copy link
Copy Markdown
Collaborator

…t the last page

Copilot AI review requested due to automatic review settings May 20, 2026 07:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts DataGrid horizontal scrolling to avoid accumulating a fractional β€œsub-column” offset once the grid reaches the last horizontal page, preventing visual overflow past the last columns.

Changes:

  • Clamp columnPixelOffset to 0 when already at the last horizontal page.
  • Force the horizontal scrollbar position to the absolute end when at the last page (maxScrollColumn + 1).
  • Clamp scrollbar-emitted scroll values so they can’t set the first visible column index beyond maxScrollColumn.
Comments suppressed due to low confidence (1)

packages/web/src/datagrid/DataGridCore.svelte:2537

  • const fractionalCol = Math.min(e.detail, maxScrollColumn); removes the fractional range (maxScrollColumn, maxScrollColumn + 1) that previously allowed representing a sub-column offset on the last page. If the last scroll column is wider than the viewport (possible in narrow layouts), dragging the scrollbar to the right can no longer scroll within that last column. If the goal is only to prevent overscrolling into empty space, clamp e.detail to a max value derived from the maximum allowed pixel offset at the end (e.g., maxScrollColumn + maxOffset/lastColWidth) instead of clamping to maxScrollColumn unconditionally.
        const fractionalCol = Math.min(e.detail, maxScrollColumn);
        const newIndex = Math.floor(fractionalCol);
        const fraction = fractionalCol - newIndex;
        const prevIndex = firstVisibleColumnScrollIndex;

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1750 to +1753
// Clamp sub-column offset when already at the last page (small delta that didn't trigger the loop)
if (columnPixelOffset > 0 && firstVisibleColumnScrollIndex >= maxScrollColumn) {
columnPixelOffset = 0;
}
@janproch

janproch commented Jun 4, 2026

Copy link
Copy Markdown
Member

@claude-review

2 similar comments
@janproch

janproch commented Jun 4, 2026

Copy link
Copy Markdown
Member

@claude-review

@janproch

janproch commented Jun 4, 2026

Copy link
Copy Markdown
Member

@claude-review

@janproch

janproch commented Jun 4, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@Stelinkaa

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9034a43c76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1751 to +1752
if (columnPixelOffset > 0 && firstVisibleColumnScrollIndex >= maxScrollColumn) {
columnPixelOffset = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow offset for oversized last columns

When the final scrollable column is wider than gridScrollAreaWidth (for example in a narrow grid or after resizing a column), maxScrollColumn is the last column index, but horizontal scrolling still needs a positive columnPixelOffset/domTable.scrollLeft to reveal the column's right edge. This clamp resets that offset to 0 on every right-scroll once the index reaches maxScrollColumn, so the off-screen right side of the last column becomes unreachable.

Useful? React with πŸ‘Β / πŸ‘Ž.

@janproch

janproch commented Jun 4, 2026

Copy link
Copy Markdown
Member

@claude review

@claude

claude Bot commented Jun 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The three fixes work together correctly:

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.

3 participants