'Unable to preventDefault inside passive event listener invocation.' Console Error When Hooking into Lifecycle Methods
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 26.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
When hooking into any of the available onDestroy(), onDestroyStarted(), etc. An Unable to preventDefault inside passive event listener invocation. is thrown in the console. If my reading is correct this is because the code is calling preventDefault() on incoming events which is causing this error to be thrown when the event is passive.
Potential Fixes Ive found:
- Filter out the passive events in the
onDriverClick()function call - Add
{ passive: false }to the event listener responsible for firingonDriverClick()
- Note I am seeing this an Angular 12 project so it might be and angular interaction issue. I currently have a workaround by removing the buttons' css classes and manually adding event listeners which call moveNext() etc.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the onDriverClick() function and the lifecycle methods such as onDestroy() and onDestroyStarted(), then reproduce the console error in the reported Angular 12 setup. Compare the passive event listener possibilities described in the issue and verify that lifecycle actions no longer produce the preventDefault error while moveNext() and related controls still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100