Skip to content

refactor(tap-click): use pointer events api#29192

Merged
liamdebeasi merged 2 commits intofeature-8.0from
tap-click-pointer-event
Mar 21, 2024
Merged

refactor(tap-click): use pointer events api#29192
liamdebeasi merged 2 commits intofeature-8.0from
tap-click-pointer-event

Conversation

@liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Mar 20, 2024

Issue number: Internal


What is the current behavior?

Amanda pointed out that the ripple effect for the Button inside of InputPasswordToggle was not working. I found out that calling ev.preventDefault on pointerdown causes mouseup to not get fired. On desktop, we rely on mouseup to know when to add the ripple effect. (touchend is not impacted)

Interestingly, calling ev.preventDefault on pointerdown does not prevent pointerup from being fired. The idea here is that if we migrate the tap click utility to use the PointerEvents API instead of separate mouse/touch listeners we can keep the existing tap click behavior while also fixing the bug that Amanda noted.

What is the new behavior?

  • Tap click nows listens for the Pointer Events instead of separate mouse/touch events

Impact to developers is fairly minimal. There should be no behavior change (other than the bug I noted being fixed). There should be a very small perf boost because this util now only adds 4 event listeners on the document instead of 7 previously.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Reviewers: Please manually test this on desktop devices as well as iOS and Android devices (not Chrome Dev Tools. iOS simulators are fine). Test that components such as ion-button correctly add the activated state (or ripple effect for MD). Also verify that the activated state is not added when tapping the button and then scrolling. For desktop, check that right clicking does not add the activated state.

@github-actions github-actions bot added the package: core @ionic/core package label Mar 20, 2024
@liamdebeasi liamdebeasi marked this pull request as ready for review March 20, 2024 21:27
@liamdebeasi liamdebeasi requested review from a team and averyjohnston and removed request for a team March 20, 2024 21:27
Copy link
Contributor

@averyjohnston averyjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on desktop plus my actual Android and iOS devices, looks good!

@liamdebeasi liamdebeasi merged commit 500854d into feature-8.0 Mar 21, 2024
@liamdebeasi liamdebeasi deleted the tap-click-pointer-event branch March 21, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants