« first day (4867 days earlier)      last day (303 days later) » 

14:49
Hi all. Wrestling with a bizarre issue: I'm using a Bootstrap 3.71 modal on a page. It should only be triggered from a button click. However, hitting Enter in every text field on the page pops it up
I did inspect on a textbox and used the monitorEvents($0). It seems to be triggered by the blur event. Searching the whole app, none of the blur events are tied to the modal
Any thoughts?
Is there a way to determine what handler function triggered an event?
You can add a breakpoint with the debugger and step through it
Problem is I don't know what event handler is being called
15:05
You can add a global blur breakpoint and should be able to backtrack from there
Thanks, Ben. Is it possible to also add a global event handler for the Enter key press?
Maybe this:
$(document).keypress(function(e){
    if(event.keyCode === 13){ console.log(e); }
});
15:25
The first thing that comes to mind is the button is in a form, and is the only button in the form, and doesn't have type=button
15:45
That fixed it!
I was testing on the server vs. localhost
But why would that affect it?
if a form has a single button, and it's not type=button, it is treated as a type=submit
when you press enter in a form, the submit button is clicked if it exists
Wow. I'd seen the submit action before when hitting enter in a form. In this case, the button's action was to launch the modal
You're a genius :)
Can I upvote your answer?
i've probably got an answer on SO to this effect somewhere
 
7 hours later…
22:43
function f(...[x, y]: [number, number]) {}
function g(x:number, y:number) {}
Are there any differences between both?

« first day (4867 days earlier)      last day (303 days later) »