// Below: Passing in true for the third parameter causes the event to be captured on the way down. Stopping propagation means that the event never reaches the listeners that are listening for it.constremoveBlocker=()=>{window.addEventListener('click',(event)=>{event.stopPropagation()},true)}// Sometime later...removeBlocker()
Thanks for answering. Did you test this on producthunt?
Apparently there are sites (ie: producthunt) where this should not work because not every click event is a click event. Sometimes there are mousedown and other events such as virtual dom based events as well.
Sounds like there would need to be bindings for each event, with associated un-bindings for each event as well. Probably doesn't change my solution too much, just needs to be applied to more things.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For adding all the events:
And for removing the added event:
Thanks for answering. Did you test this on producthunt?
Apparently there are sites (ie: producthunt) where this should not work because not every click event is a click event. Sometimes there are
mousedown
and other events such as virtual dom based events as well.Nah, just did a rudimentary test in my console.
Sounds like there would need to be bindings for each event, with associated un-bindings for each event as well. Probably doesn't change my solution too much, just needs to be applied to more things.