fix(input): clear button can now be tabbed to (#21633)

fixes https://github.com/ionic-team/ionic/issues/21549
This commit is contained in:
Liam DeBeasi
2020-07-01 10:13:12 -04:00
committed by GitHub
parent c458523b0d
commit 1dcd9de50a
2 changed files with 10 additions and 2 deletions

View File

@ -323,6 +323,10 @@ export class Input implements ComponentInterface {
}
}
private clearTextOnEnter = (ev: KeyboardEvent) => {
if (ev.key === 'Enter') { this.clearTextInput(ev); }
}
private clearTextInput = (ev?: Event) => {
if (this.clearInput && !this.readonly && !this.disabled && ev) {
ev.preventDefault();
@ -408,9 +412,9 @@ export class Input implements ComponentInterface {
aria-label="reset"
type="button"
class="input-clear-icon"
tabindex="-1"
onTouchStart={this.clearTextInput}
onMouseDown={this.clearTextInput}
onKeyDown={this.clearTextOnEnter}
/>}
</Host>
);