Skip to content

Commit a4262ce

Browse files
committed
[BUG] Clicking on an input, textarea or select works
Textarea, input, and select element can be scrollable too. `ZyngaScrollerVerticalRecognizer` will not call `doTouchStart` when they are inside a ScrollView. To prevent the long press detection to flag the click as a ghost one, we just set the touch duration to 0 in this case.
1 parent 483a75c commit a4262ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

addon/components/scroll-view.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ class ScrollView extends Component {
307307
}
308308

309309
doTouchEnd(_touches, timeStamp, event) {
310-
let preventClick = this.needsPreventClick(timeStamp - this._touchStartTimeStamp);
310+
// In most cases, `doTouchStart` is being called before `doTouchEnd`, allowing to set `_touchStartTimeStamp`
311+
// It is not true when the event occurs on some elements (`input`, `textarea`, or `select`) which can be scrolled.
312+
// In this case, `ZyngaScrollerVerticalOrganizer` will not call `doTouchStart`
313+
let touchDuration = this._touchStartTimeStamp ? (timeStamp - this._touchStartTimeStamp) : 0;
314+
let preventClick = this.needsPreventClick(touchDuration);
311315

312316
if (preventClick) {
313317
// A touchend event can prevent a follow-on click event by calling preventDefault.

0 commit comments

Comments
 (0)