Skip to content

fix(segment): avoid scrolling webkit bug - #28376

Merged
liamdebeasi merged 3 commits into
mainfrom
FW-5407
Oct 25, 2023
Merged

fix(segment): avoid scrolling webkit bug#28376
liamdebeasi merged 3 commits into
mainfrom
FW-5407

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Oct 18, 2023

Copy link
Copy Markdown
Contributor

Issue number: resolves #28373


🚨 Reviewers: Please test this on Chrome, Firefox, and Safari

What is the current behavior?

The fix in 1167a93 uncovered a WebKit bug where scrolling an element using scrollIntoView during an accelerated transition causes the segment to jump during the transition. scrollIntoView can cause parent elements to also scroll, and given that the entering view begins outside the viewport, it's possible this triggered some sort of WebKit bug where it was trying to scroll the element into view.

What is the new behavior?

  • Updated the internal implementation to use scrollBy instead of scrollIntoView. scrollBy does not attempt to scroll parent elements which avoids the WebKit issue.
  • I also updated the initial scroll to be instant rather than smoothly scroll. If a segment is added to the DOM, I'd expect it to be added with the correct scroll position (after the first render that is), so animating on load seemed like a strange behavior. User interaction will continue to use smooth scrolling though.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 7.5.2-dev.11697638908.1f04980a

@github-actions github-actions Bot added the package: core @ionic/core package label Oct 18, 2023
@liamdebeasi
liamdebeasi marked this pull request as ready for review October 18, 2023 14:57

@averyrousseau averyrousseau 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.

Tested in Chrome, Firefox, and Safari, all on both LTR and RTL. Works like a charm 👍

@liamdebeasi
liamdebeasi added this pull request to the merge queue Oct 25, 2023
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 25, 2023
@liamdebeasi
liamdebeasi added this pull request to the merge queue Oct 25, 2023
Merged via the queue into main with commit 8e2f818 Oct 25, 2023
@liamdebeasi
liamdebeasi deleted the FW-5407 branch October 25, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: rendering issue with ion-segment on iOS

2 participants