-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(searchbox): only refine if composition ended when using an IME #5963
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 26e1aaf:
|
just checking, does IE have composition support? I sas FF sometimes triggers in wrong order too: w3c/uievents#202 (comment) |
IE11 doesn't implement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
@@ -184,6 +189,9 @@ class SearchBox extends Component< | |||
spellCheck="false" | |||
maxLength={512} | |||
onInput={this.onInput} | |||
// see: https://github.com/preactjs/preact/issues/1978 | |||
// eslint-disable-next-line react/no-unknown-property | |||
oncompositionend={this.onInput} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not relevant now, but I wonder how we'll deal with these differences with only one JSX source
await act(async () => { | ||
await wait(0); | ||
|
||
searchClient.search.mockClear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searchClient.search.mockClear(); | |
castToJestMock(searchClient.search).mockClear(); |
also why not right after setup + wait 0, before starting to compose?
await act(async () => {
await wait(0);
castToJestMock(searchClient.search).mockClear();
});
// ... character etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to wrap the events inside of act()
so I'm reusing the one that waits for initialization.
Summary
Characters entered using an IME trigger search requests although the character composition is not done. This should only happen if the character has been fully composed.
This PR stops refining on
input
when composing with an IME and instead rely on thecompositionend
event in that case.Result
Characters entered using an IME do not trigger search requests until relevant.
CR-5106