event.currentTarget vs event.target

I was working on Rapua, late on a sweltering summer night while visiting family, finally tracking down the root cause of a bug I’d been studiously avoiding. The steps to reproduce were simple: Add any “content block” to a game location. Click to delete the block. Click Confirm to delete the block. The block would then disappear with a confirmation, but only sometimes. In between steps 2 and 3, there’s an event listener on the delete button that triggers a modal, populating it with all the information required to make a valid deletion. However, sometimes this information was coming back as undefined. ...

Writing · November 27, 2024 · 2 min