Skip to content

fix(segment-view): prevent NaN/Infinity scrollRatio when a single content item is present#31113

Merged
OS-susmitabhowmik merged 7 commits intonextfrom
ROU-12691-fix-ion-segment-error
May 7, 2026
Merged

fix(segment-view): prevent NaN/Infinity scrollRatio when a single content item is present#31113
OS-susmitabhowmik merged 7 commits intonextfrom
ROU-12691-fix-ion-segment-error

Conversation

@OS-susmitabhowmik
Copy link
Copy Markdown

Issue number: resolves internal


What is the current behavior?

Currently if there is a single content item present the scrollRatio is computed as NaN or Infinity resulting in a console error.

Screenshot 2026-05-05 at 1 42 51 PM

What is the new behavior?

Updates handleScroll in ion-segment-view to skip handleScroll if max <= 0

Does this introduce a breaking change?

  • Yes
  • No

Other information

@OS-susmitabhowmik OS-susmitabhowmik added the type: bug a confirmed bug report label May 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 7, 2026 2:09pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label May 5, 2026
@OS-susmitabhowmik OS-susmitabhowmik marked this pull request as ready for review May 5, 2026 20:01
@OS-susmitabhowmik OS-susmitabhowmik requested a review from a team as a code owner May 5, 2026 20:01
@OS-susmitabhowmik OS-susmitabhowmik requested a review from ShaneK May 5, 2026 20:01
Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Nice! Just a couple things to make this bullet-proof

Comment thread core/src/components/segment-view/segment-view.tsx Outdated
Comment thread core/src/components/segment-view/segment-view.tsx Outdated
Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for adding tests 🚀

Comment thread core/src/components/segment/segment.tsx Outdated
@OS-susmitabhowmik OS-susmitabhowmik merged commit 73cadb1 into next May 7, 2026
49 checks passed
@OS-susmitabhowmik OS-susmitabhowmik deleted the ROU-12691-fix-ion-segment-error branch May 7, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package type: bug a confirmed bug report

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants