Skip to content

fix(Table): add scroll tolerance so Scroller arrows reach the last column at fractional zoom - #1140

Merged
ayush-raj-eightfold merged 3 commits into
mainfrom
fix/scroller-scroll-tolerance
Jul 3, 2026
Merged

fix(Table): add scroll tolerance so Scroller arrows reach the last column at fractional zoom#1140
ayush-raj-eightfold merged 3 commits into
mainfrom
fix/scroller-scroll-tolerance

Conversation

@ayush-raj-eightfold

Copy link
Copy Markdown
Contributor

SUMMARY:

The horizontal scroll arrow buttons on <Table showScroller> can't scroll all the way to the last columns at browser zoom below 100% (e.g. 90%). The bottom scrollbar/slider works fine — only the arrow buttons fall short.

Root cause

The Scroller builds its scroll stop-points from the declared column widths (e.g. 128px), advancing with scrollOffsets.find(offset => offset > scrollLeft). At fractional zoom the browser snaps each 128px column to a slightly smaller rendered value (~127.78px at 90% / DPR 1.8) while the stop-points stay integer. So after a click targeting 128 the body settles at 127.78, and the next click's find(offset => offset > 127.78) returns 128 again → scrolling snaps right back → the arrow is stuck. At 100% zoom rendered width == declared width, which is why it only reproduces below 100%.

This is a generic Octuple bug affecting any table using showScroller with fixed-pixel columns.

Fix

Add a 1px tolerance in Scroller's onClick so the comparison skips the
boundary the scroller is already snapped to:

  • right arrow: offset > scrollLeft + 1
  • left arrow: offset < scrollLeft - 1
  • (same for both RTL branches)

GITHUB ISSUE (Open Source Contributors)

JIRA TASK (Eightfold Employees Only):

https://eightfoldai.atlassian.net/browse/ENG-199352

CHANGE TYPE:

  • Bugfix Pull Request
  • Feature Pull Request

TEST COVERAGE:

  • Tests for this change already exist
  • I have added unittests for this change

TEST PLAN:

Tested locally -

Screen.Recording.2026-07-02.at.8.14.42.PM.mov

@codesandbox-ci

codesandbox-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.95%. Comparing base (e827228) to head (978f573).

Files with missing lines Patch % Lines
src/components/Table/Internal/Body/Scroller.tsx 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1140      +/-   ##
==========================================
+ Coverage   84.45%   84.95%   +0.50%     
==========================================
  Files        1230     1230              
  Lines       21533    21527       -6     
  Branches     8176     8171       -5     
==========================================
+ Hits        18185    18288     +103     
+ Misses       3262     3153     -109     
  Partials       86       86              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/components/Table/Internal/Body/Scroller.tsx

@agupta-eightfold agupta-eightfold left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good overall, just a minor fix pending, please check.

Comment thread src/components/Table/Internal/Tests/Scroller.test.tsx Outdated
Comment thread src/components/Table/Internal/Tests/Scroller.test.tsx
ayush-raj-eightfold and others added 2 commits July 2, 2026 22:50
…rance

Replace the exact-equality scroll-extent checks in onBodyScroll with a
1px tolerance, so fractional-zoom subpixel rounding no longer leaves the
end arrow visible and clickable at the scroll end.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ayush-raj-eightfold
ayush-raj-eightfold merged commit 6e191b9 into main Jul 3, 2026
7 of 9 checks passed
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.

2 participants