mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(toggle): prevent click event from firing twice (#23146)
resolves #23041
This commit is contained in:
@ -76,6 +76,11 @@
|
|||||||
<ion-toggle slot="start" style="--border-radius: 0px;--handle-border-radius: 0px;" checked></ion-toggle>
|
<ion-toggle slot="start" style="--border-radius: 0px;--handle-border-radius: 0px;" checked></ion-toggle>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<ion-label>Stop Immediate Event Propagation</ion-label>
|
||||||
|
<ion-toggle slot="start" checked id="eventPropagation"></ion-toggle>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
|
|
||||||
@ -121,6 +126,11 @@
|
|||||||
var isTrue = el[prop] ? false : true;
|
var isTrue = el[prop] ? false : true;
|
||||||
el[prop] = isTrue;
|
el[prop] = isTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('eventPropagation').addEventListener('click', (evt) => {
|
||||||
|
evt.stopImmediatePropagation();
|
||||||
|
console.log('clicked');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</ion-app>
|
</ion-app>
|
||||||
|
@ -53,6 +53,8 @@ label {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
Reference in New Issue
Block a user