ampproject / ampproject/amphtml
Gesture Library Attempts to Cancel Events in Passive Handlers
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
This is not allowed by spec.
Changes to fix are the following:

There are several tests that rely on this behaviour that need addressing too.
```
● should cancel event when eventing
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:291:37)
● should cancel event after eventing stopped
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:307:37)
● should cancel event when anyone is ready
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:320:37)
● should cancel event when anyone is pending
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:332:37)
Gestures - with shouldNotPreventdefault
● should cancel event when eventing
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:415:40)
● should cancel event after eventing stopped
Chrome Headless 90.0.4430.212
AssertionError: expected spy to have been called exactly once, but it was called 0 times
at Context. (.../amphtml/test/unit/test-gesture.js:431:40)
```
Contributor guide
Research direction
Start with test/unit/test-gesture.js, especially the failing cases around lines 291, 307, 320, 332, 415, and 431, then trace the gesture library code those tests exercise. Update the event handling so it follows the passive-handler specification, and revise the affected tests so they verify the intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100