News for hackers. Stuff that matters.
Re:Buttons as Finite Automata by DaiPlusPlus on Thursday March 24, 2022 @04:18PM (#30794848)
> When you click the mouse down outside the button, then enter the button area and release, you do not want to fire

If you're referring to not wanting the `mouseup` event to fire, you are correct - however web-pages should not be using `mouseup` / `mousedown` to detect <button> clicks in the first place: they should be listening to only the `click` event, which is not raised when the user releases a held-down mouse button anyway. And the `click` event is also raised when the <button> is activated by other means, such as the spacebar which makes it more accessible too.

When you have the page open, open your console and run this:

`document.querySelector('input[type=button]').addEventListener('click', e => console.log("button 'click' event") )`

and then do the mousedown-and-hover-and-release described and you won't see anything logged until you really do click on it.

There are no comments on this comment yet.