Event Propagation in JavaScript: How One Line of Code Fixed My Bug