touchmove doesn't fire on removed element
See original GitHub issueIf you have
{this.state.show &&
<div onTouchStart={this.hideTheDiv} onTouchMove={...} />}
such that the onTouchStart handler removes the div (and maybe replaces it with another one in the same place, useful in certain draggable interactions), the onTouchMove handler doesn’t fire because the events of a detached element no longer bubble to document. We should probably bind the touchmove handler when the element receives touchstart instead of delegating to document.
Sort of related to #1254.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:2
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Touch Move event don't fire after Touch Start target is removed
This works for Mouse events, but doesn't work for Touch events. They don't fire after Touch Start target element is removed.
Read more >Element: touchmove event - Web APIs | MDN
The touchmove event is fired when one or more touch points are moved along the touch surface.
Read more >touchstart Event - W3Schools
Execute a JavaScript when the user touches a P element (for touch screens only): ... Note: The touchstart event will only work on...
Read more >How to bind 'touchstart' and 'click' events but not respond to both
But a click event is fired when the user clicks an element. ... So, in this case, if the browser fires both touch...
Read more >Implementing basic touch support in JavaScript - Jhey Tompkins
It's all about events · Start the touch — touchstart · Listen for any movement during the touch to handle gestures — touchmove...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
touchmove
andtouchend
events should always stick to thetouchstart
target. Check this answer for the correct implementation.I believe in react this can be implemented manually with the user of
ref
now. However, as for React’sonTouchStart
/onTouchMove
/onTouchEnd
, I would expect them all to be bound to theonTouchStart
target.I have been reading all the comments on this issue. So far, I understood that
onTouchMove
/onTouchEnd
events should be bind to theonTouchStart
event. If I got it correctly I would like to give it a try to fix this issue.