feat: allow users to disable swipe gesture on segment
See original GitHub issueFeature 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 the scrollable=true mode, so the code is already there (I guess). The problem with the scrollable 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 option changeOnSwipe or triggerChangeOnSwipe (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 different ion-segment-buttons 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:17 (8 by maintainers)
Top Related StackOverflow Question
Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/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.