diff --git a/package.json b/package.json index 807daf8..bb9c284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tp/tp-multi-toggle", - "version": "1.0.1", + "version": "1.1.0", "description": "", "main": "tp-multi-toggle.js", "scripts": { diff --git a/tp-multi-toggle.js b/tp-multi-toggle.js index 4137ef8..7a387aa 100644 --- a/tp-multi-toggle.js +++ b/tp-multi-toggle.js @@ -80,7 +80,7 @@ class TpMultiToggle extends FormElement(LitElement) { onClick(e) { const btn = closest(e.target, 'tp-button', true); - if (btn) { + if (btn && !btn.hasAttribute('selected')) { this.querySelectorAll('tp-button').forEach(el => el.removeAttribute('selected')); btn.setAttribute('selected', ''); this.dispatchEvent(new CustomEvent('selection-changed', { detail: this.value, bubbles: true, composed: true }));