What is the touch event for long press on mobile web?
Asked Answered
E

0

6

I am able to get the start of a long press via touchstart event. However, it doesn't trigger touchend after the long press is completed, when the right click menu appears nor when the right click menu is dismissed.

How can I detect when the long press is completed?

Equivocation answered 20/4, 2022 at 9:22 Comment(3)
Maybe it's the contextmenu event? developer.mozilla.org/en-US/docs/Web/API/Element/…Seigniory
@Seigniory yes that was it! Thank you 🙏 question solvedEquivocation
If you understand React, then you may look into this piece of code: github.com/uidotdev/usehooks/blob/main/index.js#L664-L726 This is useLongPress hookChavannes

© 2022 - 2024 — McMap. All rights reserved.