I've got this code in which an event is first triggered by the user. Then the event is triggered again within the event-handler.
inputs.forEach(function(item) {
item.addEventListener('focus', function() {
item.parentNode.focus();
setTimeout(function() {
item.parentNode.blur();
item.focus();
}, 1000);
});
});
Currently this leads to an infinity recursion.
When I could find a way to detect if the event was triggered by the user then I could check for that. And so avoid the recursion.
Older StackOverflow answers talk about an "originalEvent"-property of the event-object: Detect if a scroll event is triggered manually in jQuery
But this property has always been undefined in my trying.
Therefore: Is there a way how I can check if the event was triggered by the user?