mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(checkbox): click events on ion-item now fire properly (#22561)
resolves #22557
This commit is contained in:
@ -114,10 +114,7 @@ export class Checkbox implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onClick = (ev: Event) => {
|
private onClick = () => {
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
|
|
||||||
this.setFocus();
|
this.setFocus();
|
||||||
this.checked = !this.checked;
|
this.checked = !this.checked;
|
||||||
this.indeterminate = false;
|
this.indeterminate = false;
|
||||||
@ -171,6 +168,14 @@ export class Checkbox implements ComponentInterface {
|
|||||||
{labelText}
|
{labelText}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
|
onClick={(ev: Event) => {
|
||||||
|
{/**
|
||||||
|
* This is needed otherwise any click
|
||||||
|
* events set on `ion-item` are fired twice
|
||||||
|
*/}
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation()
|
||||||
|
}}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
aria-checked={`${checked}`}
|
aria-checked={`${checked}`}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
Reference in New Issue
Block a user