question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: content global click listener causing issues at scale

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

The ion-content component uses a click event listener to prevent clicks while scrolling.

https://github.com/ionic-team/ionic-framework/blob/6309d5ddbaa7da5e37eda4e19866baf380069578/core/src/components/content/content.tsx#L122-L128

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 use ion-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 of ion-content like ion-refresher and ion-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/

https://user-images.githubusercontent.com/1731025/145462755-f2ec2853-f50d-4d6e-84b6-089a5232fb67.mov

Without Ion Content

https://angular-ivy-zugcxz.stackblitz.io

https://user-images.githubusercontent.com/1731025/145462781-c522e48b-1e38-4de8-a377-95b8969ef31a.mov

Code Reproduction URL

https://angular-ivy-63drzo.stackblitz.io/

Ionic Info

I’m using the latest version.

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tlaverdurecommented, Dec 10, 2021

Gonna test it out in a sec, thanks for the quick response!

0reactions
ionitron-bot[bot]commented, Jan 12, 2022

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

possible EventEmitter memory leak detected - node.js
I found this page because I got this warning and in my case there was a bug in some code I was using...
Read more >
Summary of the Amazon Kinesis Event in the Northern ...
Unfortunately, the prolonged issue with Kinesis Data Streams triggered a latent bug in this buffering code that caused the Cognito webservers ...
Read more >
Introduction to events - Learn web development | MDN
The Node.js event model relies on listeners to listen for events and emitters ... The trouble comes when the user has not submitted...
Read more >
A Definitive Guide to Handling Errors in JavaScript - Kinsta
Getting tripped up by errors in your JavaScript? We'll show you how to tame those errors so you can get back to developing...
Read more >
Insect decline in the Anthropocene: Death by a thousand cuts
Indeed, most biologists agree that the world has entered its sixth mass extinction event, the first since the end of the Cretaceous Period...
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