-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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: content global click listener causing issues at scale #24359
Comments
Thanks for the issue. I can reproduce this behavior. The code in question has its roots in the early Ionic v3 days, nearly 7 years ago: ionic-team/ionic-v3@43b8b4a#diff-99a1d9c14c8cea5a04cc5f1f7f7d688e924009325721f7ce17dd125bb425a0a3R38-R39 It appears that this was an attempt to prevent clicks from propagating while scrolling or other gestures were taking place. At the time this code was written, Chrome 43 was the latest Chrome and UIWebView was used instead of WKWebView. While I do not know the full context of this change, I think it is likely that this change was made to work around bugs in old browsers/webviews. For most developers, the body of this I removed the handler and tested the update in your application and it seems to help performance. There is definitely still an overhead from Angular/Zone.js, but the overhead from
|
Hey there, I merged in a fix for this via #24360. Please feel free to continue testing and let me know if you run into any issues. Thanks again! |
Gonna test it out in a sec, thanks for the quick response! |
Hey @liamdebeasi this fix has provided some improvement. However, I'm still experiencing some sluggishness while clicking, even with zone.js disabled. https://stackblitz.com/edit/angular-ivy-dmvpqp Looking at things simply, when I don't use I found a couple links on bugs.webkit.org that you were involved in but haven't gotten anywhere 😢 https://bugs.webkit.org/show_bug.cgi?id=222187 From my own testing I can see that any type of user interaction with components within the shadow DOM tree causes rendering events labeled as "Styles Invalidated" which subsequently trigger "Styles Recalculated" events. The recalculations are taking > 400ms which seems to be blocking the UI. Do you know if there is a way to disable shadow DOM on the stencil components or is that only available during compilation of the core components? If that isn't an option, my next course of action would be to implement my own content component for situations where I need to use a lot of components. Leaning this way would introduce challenges with integrating other ionic components though as they have hard assumptions around using https://github.com/ionic-team/ionic-framework/search?q=%22an+ion-content%22&type=code |
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. |
Prerequisites
Ionic Framework Version
Current Behavior
The
ion-content
component uses a click event listener to prevent clicks while scrolling.ionic-framework/core/src/components/content/content.tsx
Lines 122 to 128 in 6309d5d
This was added in version 4.x to fix an issue described as "tap-click deadlock". I'm not exactly sure what that means. The PR doesn't really include a useful description or tests to explain what the functionality adds/fixes. However, there is a list of issues in the PR that are related to click functionality misbehaving while scrolling that were closed in effect:
fix(content): tap-click deadlock #17170
I've found that this event listener drastically decreases click performance with increasing amounts of DOM nodes within the
ion-content
component. Particularly in Webkit browsers which seem to handle event listeners that originate from a parent element differently than Chrome. Even with virtual scrolling added, the UI just feels slow and buggy when clicking. The only real solution that I've found is to not useion-content
but that would mean losing all the benefits of that component. Such as tapping the nav to scroll to the top of the page or using other components that should be children ofion-content
likeion-refresher
andion-infinite-scroll
.Expected Behavior
If this code is no longer needed for current browser engines it should be removed, or allow developers to control this behavior with a setting in
IonicConfig
. For my purposes, I don't really need to block clicks while scrolling.Steps to Reproduce
You can test these this StackBlitz links in Chrome and Safari. Both browsers are slower with
ion-content
but Safari is much worse.With Ion Content
https://angular-ivy-63drzo.stackblitz.io/
Screen.Recording.2021-12-09.at.2.24.05.PM.mov
Without Ion Content
https://angular-ivy-zugcxz.stackblitz.io
Screen.Recording.2021-12-09.at.2.24.54.PM.mov
Code Reproduction URL
https://angular-ivy-63drzo.stackblitz.io/
Ionic Info
I'm using the latest version.
Additional Information
No response
The text was updated successfully, but these errors were encountered: