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: allow users to disable swipe gesture on segment #22048
Comments
+1 |
Thanks for the feature request. Which app are you testing this with on Android? I am testing on the phone app on Android and the swipe behavior matches iOS. |
The default Google dialer app comes to mind (Pixel 2 XL), so possibly a version difference? Facebook Messenger Lite. Google Analytics. Google Photos app. None of these apps allow swiping segments/tabs on my device.. |
Hmm can you provide a video of what you mean? I do not see these on my end. |
Not a whole lot apps use this kind of component on Android it seems. I can't find many good examples, but Facebook and Google Play Store could be seen as some. I use the |
@SansDK That's exactly my use-case. A sticky segment that scrolls with content until it hits the top and stays there. (Not a trivial feature, I might add, with how buggy I'll try to upload a video if I can. I need to find another device that can make a recording (Unless you can recommend some decent screen recorder software. Maybe I can do this via remote debugging...) |
Oh I see, so you would like to disable the swipe gesture and just use the segment by clicking? I think I may have misunderstood the original request. |
Yes, I think that would be enough to solve the problem. Exactly! If there are some apps that DO use swipe to change on Android, then it makes sense to keep that functionality, and the ability to disable the feature would be enough to prevent spurious swipes in the vertical direction from actually changing segments. |
Ok makes sense, I think this is something we can easily add. |
Here's a video I recorded of the issue with scrolling on a sticky ion-segment, now that you already understand what's going on, hehe 👍 Notice how it scrolls with the content, then also notice how it SNAPS to "Ideas" after scrolling where the touch gesture starts on the segment: |
Also, awesome. Thank you. Glad this should be doable! |
Hi there! |
Thank you! Here is some getting started info on creating a PR: https://github.com/ionic-team/ionic-framework/blob/master/.github/CONTRIBUTING.md#creating-a-pull-request One thing to be careful of is just disabling the gesture will also disable the slide animation of the indicator from one segment button to the next. Maybe @brandyscarney has some thoughts on how we can get around this? |
This issue has been labeled as If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort. For a guide on how to create a pull request and test this project locally to see your changes, see our contributing documentation. Thank you! |
Thank you for letting me know, @liamdebeasi. I allowed running I will soon submit the PR, including the changes above. |
Thanks for the issue. This has been resolved via #22087, and the feature will be available in an upcoming release of Ionic Framework. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Feature Request
Ionic version:
[x] 5.x
Describe the Feature Request
Related to #21251.
This issue has been closed as the issue matched "the native iOS spec.", which is fine. But as @lincolnthree already mentioned in the comments on his issue, this behavior does not seem to match the native Android spec.
I feel like we can and should give Ionic users the option to choose wether they want the
ionChange
event to be triggered on this swipe gesture or not. It's basically already disabled in thescrollable=true
mode, so the code is already there (I guess). The problem with thescrollable
mode is that it isn't always desirable because of the scroll bar.If we were to add this feature, I think we should default to the current behavior for backwards compatibility.
Describe Preferred Solution
In the
ion-segment
component, there should be an optionchangeOnSwipe
ortriggerChangeOnSwipe
(or something similar like that).The default value should be true, to keep it the same as it is now.
When this is set to false, the behavior seen in #21251 should not trigger an
ionChange
event. Also, I think swiping between differention-segment-button
s should be disabled in this case.Describe Alternatives
I tried using the
scrollable
attribute, and tried hiding the scroll bar, but this is a bad and hacky "solution".Related Code
Additional Context
The text was updated successfully, but these errors were encountered: