Skip to content
Snippets Groups Projects
Unverified Commit cc12b7e1 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Fix submit event being blocked in dbp-button

parent 9be5c627
No related branches found
No related tags found
No related merge requests found
Pipeline #106335 failed
{ {
"name": "dbp-toolkit", "name": "dbp-toolkit",
"version": "0.1.1", "version": "0.1.2",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"private": true, "private": true,
......
...@@ -20,6 +20,17 @@ export class Button extends ScopedElementsMixin(LitElement) { ...@@ -20,6 +20,17 @@ export class Button extends ScopedElementsMixin(LitElement) {
this.spinner = false; this.spinner = false;
this.noSpinnerOnClick = false; this.noSpinnerOnClick = false;
this.disabled = 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() { static get scopedElements() {
...@@ -42,12 +53,6 @@ export class Button extends ScopedElementsMixin(LitElement) { ...@@ -42,12 +53,6 @@ export class Button extends ScopedElementsMixin(LitElement) {
}; };
} }
clickHandler() {
if (!this.noSpinnerOnClick) {
this.start();
}
}
start() { start() {
this.spinner = true; this.spinner = true;
this.disabled = true; this.disabled = true;
...@@ -77,7 +82,6 @@ export class Button extends ScopedElementsMixin(LitElement) { ...@@ -77,7 +82,6 @@ export class Button extends ScopedElementsMixin(LitElement) {
render() { render() {
return html` return html`
<button <button
@click="${this.clickHandler}"
class="button ${this.type}" class="button ${this.type}"
?disabled="${this.disabled}"> ?disabled="${this.disabled}">
${this.value} ${this.value}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment