Comment by Rygian

2 hours ago

Because in those contexts, the Space key is being used as a physical mirror of the on-screen button, and on-screen buttons are UX'd to perform action when released.

These two interactions should behave identically:

- Hover over a button, press mouse button 1, release button 1.

- Tab over to a button, press spacebar, release spacebar.

Why on-screen buttons are UX'd to behave this way is a logical follow-up question. I'd wager that it gives a means to bail out of the clicking (e.g. by moving the mouse out of the on-screen button before releasing mousebutton 1, or by pressing Esc while having spacebar still depressed).

Yes, the bailing-out explanation is right. With a mouse it's intentional that you should be able to push the pointer off the button with the mouse button still pressed to cancel.

(Esc while Space is held doesn’t cancel, but Tab does.)

You’re only answering half of the inconsistency: because Enter activates buttons like any other key, on keydown.

  • Just diving in without full context, but, enter is often a completion action. Historically often a full carriage return. It often means "submit data".

    So this could be the oddity