Today I Learned

Daily reflections on work and learning—what I did and what I learned.

2026년 9월

2026-09-25

I pressed two keys together twice and it dashed in only one direction — don't commit on the first event

Why committing the direction on the first key fails to merge the second key, since the browser sends keys pressed at the same time as separate keydown events, and how a 50ms collection window solved it

  • Even for keys pressed at the same time, the browser sends a separate keydown event for each key, in order
  • If you commit the result on the first key event, the second key cannot be merged as soon as a frame or simulation step slips in between the events