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

bug: ion-toggle and rendered label blocks vertical gestures/touch-scrolling #27254

Closed
3 tasks done
lincolnthree opened this issue Apr 20, 2023 · 10 comments · Fixed by #27255
Closed
3 tasks done

bug: ion-toggle and rendered label blocks vertical gestures/touch-scrolling #27254

lincolnthree opened this issue Apr 20, 2023 · 10 comments · Fixed by #27255
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@lincolnthree
Copy link

lincolnthree commented Apr 20, 2023

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

With the new 'modern form syntax' ion-toggle now renders or contains its label as a child element. This means that its gesture config is now taking over the entire width of the parent container, and blocks touch/scroll gestures on not just the toggle icon/button, but on the entire label/row. This can lead to some very confusing user interactions.

See video:

Screen.Recording.2023-04-20.at.12.08.17.PM.mov

Note, I have not tried it, but I suspect that other elements such as ion-range, which also have gestures, may also suffer from this same issue.

Expected Behavior

The toggle's label should not be a gesture capturing element.

Steps to Reproduce

Checkout repro url and scroll as seen in video.

Code Reproduction URL

https://github.com/lincolnthree/ionic-bugs/tree/issue-27254

Ionic Info

Ionic:

Ionic CLI : 6.20.3 (/Users/lincoln/.nvm/versions/node/v16.14.0/lib/node_modules/@ionic/cli)
Ionic Framework : not installed
@angular-devkit/build-angular : 15.1.6
@angular-devkit/schematics : 15.1.6
@angular/cli : 15.1.6
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 4.6.3
@capacitor/android : not installed
@capacitor/core : 4.6.3
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run (update available: 1.7.2) : 1.7.1

System:

NodeJS : v16.14.0 (/Users/lincoln/.nvm/versions/node/v16.14.0/bin/node)
npm : 8.3.1
OS : macOS

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Apr 20, 2023
@liamdebeasi liamdebeasi self-assigned this Apr 20, 2023
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Apr 20, 2023
@liamdebeasi liamdebeasi removed their assignment Apr 20, 2023
@ionitron-bot ionitron-bot bot removed the triage label Apr 20, 2023
@liamdebeasi
Copy link
Contributor

Thanks! Mind giving this dev build a shot?

7.0.4-dev.11682008337.11c1bc0d

@lincolnthree
Copy link
Author

lincolnthree commented Apr 21, 2023

Hey Liam,

Thanks - Unfortunately, this does not seem to resolve the issue here in my sandbox. I'm going to try a few more times, but as of right now, I have not noticed a change in gestures when interacting with toggles.

Ionic:

   Ionic CLI                     : 7.0.1 (/Users/lincoln/.nvm/versions/node/v16.14.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 7.0.4-dev.11682008337.11c1bc0d
   @angular-devkit/build-angular : 15.1.6
   @angular-devkit/schematics    : 15.1.6
   @angular/cli                  : 15.1.6
   @ionic/angular-toolkit        : 6.1.0

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Apr 21, 2023

Make sure @ionic/[email protected] is getting installed too as that is where the fix is.

@lincolnthree
Copy link
Author

Make sure @ionic/[email protected] is getting installed too as that is where the fix is.

image

@lincolnthree
Copy link
Author

I tried both in my production app and also in the sample repo.

@lincolnthree
Copy link
Author

Let me try a full reinstall of node modules.

@lincolnthree
Copy link
Author

Ok, so I do notice one change. Swiping left-right no longer toggles, but swiping up/down still does not scroll as expected:

Screen.Recording.2023-04-21.at.10.44.10.AM.mov

@liamdebeasi
Copy link
Contributor

Good catch! Here's a dev build with another fix: 7.0.4-dev.11682092361.1656526f

@lincolnthree
Copy link
Author

Thanks @liamdebeasi - The latest Dev build appears to fix the issue!

liamdebeasi added a commit that referenced this issue Apr 26, 2023
Issue number: resolves #27254

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The swipe gesture is currently applied to the entire `ion-toggle`
element. This was fine for the legacy syntax, but with the modern syntax
it means users can swipe on the label text which is not correct.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- The toggle now creates the gesture on the `.toggle-icon` element which
is the container for the knob for both modern and legacy syntaxes.
- Moved `touch-action: none` to the host of the legacy toggle. This was
preventing scrolling from happening on the modern toggle. I double
checked with native iOS and you can scroll when a pointer moves over a
toggle.

The structure of this fix was designed to match what `ion-range` does:
https://github.com/ionic-team/ionic-framework/blob/a8749929e01b07043631fbc8c522d39cbc3ae798/core/src/components/range/range.tsx#L282-L296

| Modern | Legacy |
| - | - |
| <video
src="https://user-images.githubusercontent.com/2721089/233431240-11f0c94f-d86b-4975-afd5-e534262a6f16.mov"></video>
| <video
src="https://user-images.githubusercontent.com/2721089/233431275-6c6f7fef-6cc0-4adc-8915-6fd5c3795ade.mov"></video>
|



## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@ionitron-bot
Copy link

ionitron-bot bot commented May 26, 2023

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants