Skip to content
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 spellcheking in beforeInput bug on firefox #24882

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function getFallbackBeforeInputChars(
domEventName: DOMEventName,
nativeEvent: any,
): ?string {

// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
// If composition event is available, we extract a string only at
Expand Down Expand Up @@ -360,6 +361,11 @@ function getFallbackBeforeInputChars(
}
}
return null;

// Firefox fires the 'input' event when a user types an incorrectly spelled
// word and uses the spellchecker to correct it
case 'input':
return nativeEvent.data
case 'compositionend':
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ describe('BeforeInputEventPlugin', () => {
eventSimulator: simulateEvent,
eventSimulatorArgs: ['textInput', {data: 'abcß'}],
},
{
eventSimulator: simulateEvent,
eventSimulatorArgs: ['input', {data: 'test string'}],
},
{
eventSimulator: simulateKeyboardEvent,
eventSimulatorArgs: ['keypress', {which: keyCode('a')}],
Expand Down