diff --git a/src/ui/button.js b/src/ui/button.js index 2579a26ee..3253f6fe0 100644 --- a/src/ui/button.js +++ b/src/ui/button.js @@ -119,10 +119,11 @@ export default function Button(options = {}) { onRender() { buttonEl = document.getElementById(this.getId()); buttonEl.removeEventListener('click', this.handleButtonClick); - buttonEl.addEventListener('click', (e) => { + this.handleButtonClick = (e) => { this.dispatch('click'); e.preventDefault(); - }); + }; + buttonEl.addEventListener('click', this.handleButtonClick); buttonEl.addEventListener('mouseenter', (e) => { this.dispatch('mouseenter'); e.preventDefault();