Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(segment): add swipeGesture property to allow for disabling of the swipe gesture #22087

Conversation

TakumaKira
Copy link
Contributor

closes #22048

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: #22048

What is the new behavior?

  • By setting changeOnSwipe property to false, developers can disable to select ionSegmentButton inside on swiping/dragging.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@ionitron-bot ionitron-bot bot added package: angular @ionic/angular package package: core @ionic/core package labels Sep 14, 2020
@brandyscarney
Copy link
Member

Could we call this swipeGesture to match the naming of ion-menu and ion-nav?

<ion-menu swipeGesture="false" contentId="nav"> </ion-menu>

@brandyscarney brandyscarney changed the title feat(segment): add 'changeOnSwipe' property feat(segment): add 'swipeGesture' property to disable swiping between segment buttons Sep 15, 2020
@brandyscarney brandyscarney added this to the 5.4.0 milestone Sep 15, 2020
@brandyscarney
Copy link
Member

Thank you for this by the way! The code looks good on initial review. Requested myself and Liam to test it. 🙂

Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

A few small changes, but otherwise this looks really good. Nice job!

core/src/components/segment/segment.tsx Outdated Show resolved Hide resolved
core/src/components/segment/segment.tsx Show resolved Hide resolved
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

One small test change, then I think we are good to merge!

core/src/components/segment/test/basic/index.html Outdated Show resolved Hide resolved
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for taking care of this!

@liamdebeasi liamdebeasi changed the title feat(segment): add 'swipeGesture' property to disable swiping between segment buttons feat(segment): add swipeGesture property to allow disabling of the swipe gesture Nov 10, 2020
@liamdebeasi liamdebeasi changed the title feat(segment): add swipeGesture property to allow disabling of the swipe gesture feat(segment): add swipeGesture property to allow for disabling of the swipe gesture Nov 10, 2020
@liamdebeasi
Copy link
Contributor

@TakumaKira One last thing -- can you sync this branch with the latest master? We had a few build issue with node 15/npm 7 that have since been resolved, but you will need to grab the latest from master to get the fixes.

liamdebeasi and others added 21 commits November 14, 2020 00:08
@github-actions github-actions bot added package: react @ionic/react package package: vue @ionic/vue package labels Nov 13, 2020
@github-actions github-actions bot removed the package: react @ionic/react package label Nov 13, 2020
@TakumaKira
Copy link
Contributor Author

@liamdebeasi

@TakumaKira One last thing -- can you sync this branch with the latest master? We had a few build issue with node 15/npm 7 that have since been resolved, but you will need to grab the latest from master to get the fixes.

I think I'm done ;) I rebased the branch on the current master(commit d77a9d5).

@liamdebeasi liamdebeasi merged commit 65bc995 into ionic-team:master Nov 13, 2020
@liamdebeasi
Copy link
Contributor

Merged. Thank you!

@ZaLiTHkA
Copy link

I just had to apply the hacky workaround as posted in this comment on #22161 (which led me to #22048, which led me here), but I had to do this in a current app with @ionic/angular@6.1.1 and @angular/core@13.3.3.. has this issue perhaps returned in recent builds?

one intersting observation though: the "segment selection change on page scroll" issue only appears to happen on ion-segment elements that do have scrollable enabled. I'm not sure if this was a requirement of the original problem.. so could the behaviour I'm seeing here be caused by something else instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: allow users to disable swipe gesture on segment