fix(a11y): only preventDefault for the onClick event (#22573)

This commit is contained in:
Brandy Carney
2020-11-25 16:56:51 -05:00
committed by GitHub
parent 5275332e43
commit 07868354aa
5 changed files with 12 additions and 14 deletions

View File

@ -114,7 +114,9 @@ export class Checkbox implements ComponentInterface {
}
}
private onClick = () => {
private onClick = (ev: any) => {
ev.preventDefault();
this.setFocus();
this.checked = !this.checked;
this.indeterminate = false;
@ -168,14 +170,6 @@ export class Checkbox implements ComponentInterface {
{labelText}
</label>
<input
onClick={(ev: Event) => {
{/**
* This is needed otherwise any click
* events set on `ion-item` are fired twice
*/}
ev.preventDefault();
ev.stopPropagation()
}}
type="checkbox"
aria-checked={`${checked}`}
disabled={disabled}