Skip to content

fix(segment): scroll to active segment-button on first load - #28276

Merged
averyrousseau merged 4 commits into
mainfrom
FW-5079
Oct 4, 2023
Merged

fix(segment): scroll to active segment-button on first load#28276
averyrousseau merged 4 commits into
mainfrom
FW-5079

Conversation

@averyrousseau

@averyrousseau averyrousseau commented Oct 3, 2023

Copy link
Copy Markdown
Contributor

Issue number: resolves #28096


What is the current behavior?

When a segment button is clicked, the segment will auto-scroll to position the newly active button fully in view. However, this behavior does not occur on first load. This means that when a segment is initialized with a value corresponding to an off-screen button, the button will remain off-screen.

What is the new behavior?

The same auto-scroll behavior from button click now also occurs on component load.

Does this introduce a breaking change?

  • Yes
  • No

Other information

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

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested this out locally - removed the code with the raf and ran the e2e test and confirmed it failed (expected). Also tested out the segment code in the e2e test by running it in the browser and it is scrolling the view to the active segment button and the highlight size is correct. Works great!

Comment thread core/src/components/segment/test/scrollable/segment.e2e.ts Outdated
@averyrousseau
averyrousseau added this pull request to the merge queue Oct 4, 2023
Merged via the queue into main with commit 1167a93 Oct 4, 2023
@averyrousseau
averyrousseau deleted the FW-5079 branch October 4, 2023 17:34
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: ion-segment does not automatically slide to the active ion-segment-button

3 participants