feat: allow users to disable swipe gesture on segment

See original GitHub issue

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 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Nov 13, 2020

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.

0reactions
ionitron-bot[bot]commented, Dec 13, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 13 Segmented Control: Remove swipe gesture to ...
On iOS 13, with UISegmentedControls, you can now swipe/pan to change the selected segment in addition to touching the segment you would like...
Read more >
SegmentedUI Widget
One of the main uses of this capability is to enable the option that allows users to delete a Segment row, by swiping...
Read more >
How to disable interactive swipe to dismiss for view ...
Fortunately, UIKit has a dedicated property that deactivates the swipe to dismiss behavior: isModalInPresentation . This is false by default, ...
Read more >
How to Turn Off Dynamic Island Content for iPhone 14 Pro ...
Though you can't disable it directly, users can dismiss animations by swiping left or right across the Island.
Read more >
iPhone 14 Pro: How to Turn Off Dynamic Island Content
When Apple unveiled its latest iPhone 14 Pro models, many people were ... the same swipe gesture on the larger segment to make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found