diff --git a/package.json b/package.json index 00fee212a3a39f296caf6f2bf6a703d3c671229f..59cd2f1450a2a1c63190b6c06191f492cfc1076a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dbp-toolkit", - "version": "0.1.1", + "version": "0.1.2", "description": "", "main": "index.js", "private": true, diff --git a/packages/common/src/button.js b/packages/common/src/button.js index 1c9a975272e4d90820b7fbe6b00e29343fbe5419..e2f7bf31f9e42f00b44381aaa6ed52011c57eb9a 100644 --- a/packages/common/src/button.js +++ b/packages/common/src/button.js @@ -20,6 +20,17 @@ export class Button extends ScopedElementsMixin(LitElement) { this.spinner = false; this.noSpinnerOnClick = false; this.disabled = false; + + // https://bugs.chromium.org/p/chromium/issues/detail?id=1061240#c12 + this.addEventListener('click', (e) => { + if (this.disabled) { + e.stopImmediatePropagation(); + } + + if (!this.noSpinnerOnClick) { + this.start(); + } + }); } static get scopedElements() { @@ -42,12 +53,6 @@ export class Button extends ScopedElementsMixin(LitElement) { }; } - clickHandler() { - if (!this.noSpinnerOnClick) { - this.start(); - } - } - start() { this.spinner = true; this.disabled = true; @@ -77,7 +82,6 @@ export class Button extends ScopedElementsMixin(LitElement) { render() { return html` <button - @click="${this.clickHandler}" class="button ${this.type}" ?disabled="${this.disabled}"> ${this.value}