Well this question has been asked before but in context of jQuery. In jQuery we can check it by originalEvent property of event Object (link) which tells whether its a manual or programmed event.
In my case I am using Javascript Event listeners and triggers. Can we differentiate between the two kind of events (programmed and manual) in this case?
If not then any workarounds?
My Listeners:
function setUpListeners(){ _cellViewWrapper.addEventListener('mousedown',mouseDownHandler,false); _cellViewWrapper.addEventListener('mouseover',mouseEnter,false); _cellViewWrapper.addEventListener('blur',blurHandler,true); _cellViewWrapper.addEventListener('focus',focusEventHandler,true); }` Trigger use Cases:
if(!IE_FLAG) hidePicker(); //if browser is internet explorer else{ //if blur is allowed then hide Picker if(_ieBlurAllowed) hidePicker(); //if blur is not allowed -- keep focus on picker input //triggering the focus event here else blurredElement.focus(); / }if((inputElem !== _focussedInput)) setTimeout(function(){ inputElem.focus(); },10);
and many more...
event.isTrusted- but only partial browser supportEventobject provides, and thatoriginalPreventcan be used to access those, as it refers to the native JS Event object. But I don’t see how that would allow to differentiate between an event triggered by the user and one triggered via script.