ten1seven / what-input

A global utility for tracking the current input method (mouse/pointer, keyboard or touch).
https://ten1seven.github.io/what-input
MIT License
1.35k stars 89 forks source link

Handle events in capture phase rather than bubbling phase #126

Closed jojo080889 closed 2 years ago

jojo080889 commented 2 years ago

Recently ran into a conflict between what-input and another package I'm working with. Problem was that the components I'm using in the other package call e.preventDefault() internally, and so what-input would not switch from keyboard to mouse properly.

By listening to the capture phase, what-input can handle these events before they go down to the target.

ten1seven commented 2 years ago

@jojo080889 thanks for the PR! That update checks out in my testing. I'll merge and create a new release.