mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
fix(input): clear button can now be tabbed to (#21633)
fixes https://github.com/ionic-team/ionic/issues/21549
This commit is contained in:
@ -147,7 +147,11 @@
|
|||||||
appearance: none;
|
appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.has-focus.has-value) .input-clear-icon {
|
.input-clear-icon:focus {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.has-value) .input-clear-icon {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +323,10 @@ export class Input implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private clearTextOnEnter = (ev: KeyboardEvent) => {
|
||||||
|
if (ev.key === 'Enter') { this.clearTextInput(ev); }
|
||||||
|
}
|
||||||
|
|
||||||
private clearTextInput = (ev?: Event) => {
|
private clearTextInput = (ev?: Event) => {
|
||||||
if (this.clearInput && !this.readonly && !this.disabled && ev) {
|
if (this.clearInput && !this.readonly && !this.disabled && ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
@ -408,9 +412,9 @@ export class Input implements ComponentInterface {
|
|||||||
aria-label="reset"
|
aria-label="reset"
|
||||||
type="button"
|
type="button"
|
||||||
class="input-clear-icon"
|
class="input-clear-icon"
|
||||||
tabindex="-1"
|
|
||||||
onTouchStart={this.clearTextInput}
|
onTouchStart={this.clearTextInput}
|
||||||
onMouseDown={this.clearTextInput}
|
onMouseDown={this.clearTextInput}
|
||||||
|
onKeyDown={this.clearTextOnEnter}
|
||||||
/>}
|
/>}
|
||||||
</Host>
|
</Host>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user