mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
This commit is contained in:
@@ -831,6 +831,15 @@ export class Input implements ComponentInterface {
|
||||
*/
|
||||
ev.preventDefault();
|
||||
}}
|
||||
onFocusin={(ev) => {
|
||||
/**
|
||||
* Prevent the focusin event from bubbling otherwise it will cause the focusin
|
||||
* event listener in scroll assist to fire. When this fires, focus will be moved
|
||||
* back to the input even if the clear button was never tapped. This poses issues
|
||||
* for screen readers as it means users would be unable to swipe past the clear button.
|
||||
*/
|
||||
ev.stopPropagation();
|
||||
}}
|
||||
onClick={this.clearTextInput}
|
||||
>
|
||||
<ion-icon aria-hidden="true" icon={mode === 'ios' ? closeCircle : closeSharp}></ion-icon>
|
||||
|
||||
@@ -124,7 +124,7 @@ export const enableScrollAssist = (
|
||||
const focusOut = () => {
|
||||
hasKeyboardBeenPresentedForTextField = false;
|
||||
win?.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
||||
componentEl.removeEventListener('focusout', focusOut, true);
|
||||
componentEl.removeEventListener('focusout', focusOut);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -155,15 +155,15 @@ export const enableScrollAssist = (
|
||||
);
|
||||
|
||||
win?.addEventListener('ionKeyboardDidShow', keyboardShow);
|
||||
componentEl.addEventListener('focusout', focusOut, true);
|
||||
componentEl.addEventListener('focusout', focusOut);
|
||||
};
|
||||
|
||||
componentEl.addEventListener('focusin', focusIn, true);
|
||||
componentEl.addEventListener('focusin', focusIn);
|
||||
|
||||
return () => {
|
||||
componentEl.removeEventListener('focusin', focusIn, true);
|
||||
componentEl.removeEventListener('focusin', focusIn);
|
||||
win?.removeEventListener('ionKeyboardDidShow', keyboardShow);
|
||||
componentEl.removeEventListener('focusout', focusOut, true);
|
||||
componentEl.removeEventListener('focusout', focusOut);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user