mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
fix(input): clear button is not activated on swipe (#25825)
resolves #24857
This commit is contained in:
@ -402,12 +402,6 @@ export class Input implements ComponentInterface {
|
||||
this.isComposing = false;
|
||||
};
|
||||
|
||||
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();
|
||||
@ -496,8 +490,15 @@ export class Input implements ComponentInterface {
|
||||
aria-label="reset"
|
||||
type="button"
|
||||
class="input-clear-icon"
|
||||
onPointerDown={this.clearTextInput}
|
||||
onKeyDown={this.clearTextOnEnter}
|
||||
onPointerDown={(ev) => {
|
||||
/**
|
||||
* This prevents mobile browsers from
|
||||
* blurring the input when the clear
|
||||
* button is activated.
|
||||
*/
|
||||
ev.preventDefault();
|
||||
}}
|
||||
onClick={this.clearTextInput}
|
||||
/>
|
||||
)}
|
||||
</Host>
|
||||
|
||||
Reference in New Issue
Block a user