Closed Bug 984255 Opened 10 years ago Closed 9 years ago

[keyboard2] Pressing backspace key won't revert the word suggestion

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: rudyl, Unassigned)

References

Details

(Whiteboard: [keyboard2-feature-parity])

Pressing the backspace key on the new keyboard app won't revert the word suggestion.

STR
===
 1. Input a word by word suggestion. 
 2. Press [backspace] key.

Expected result: The word suggestion would be reverted to the user original input. 
Actual result: Only delete one space without reverting.
Assignee: nobody → iliu
(In reply to Rudy Lu [:rudyl] from comment #0)
> Pressing the backspace key on the new keyboard app won't revert the word
> suggestion.
> 
> STR
> ===
>  1. Input a word by word suggestion. 
>  2. Press [backspace] key.

I try to reproduce the issue here with above steps. But it's hard to reproduce. My reproduced steps are as following:
STR
===
1. Input a word by word suggestion.
2. Click [space] key, then will apply the word suggestion directly.
3. Press [backspace] key.

Then, we are able to reproduce it. There is a error console while clicking [space] key in step 2.
======== log =========
E/GeckoConsole( 1168): [JavaScript Error: "TypeError: this.correction is null" {file: "app://demo-keyboard.gaiamobile.org/js/autocorrect.js" line: 312}]

I will keep to find out the root cause.
Status: NEW → ASSIGNED
(In reply to Ian Liu [:ianliu] from comment #1)
> (In reply to Rudy Lu [:rudyl] from comment #0)
> ======== log =========
> E/GeckoConsole( 1168): [JavaScript Error: "TypeError: this.correction is
> null" {file: "app://demo-keyboard.gaiamobile.org/js/autocorrect.js" line:
> 312}]

For reason of the error console, this.correction be cleared before it be saved in reversion. Because replaceSurroundingText() trigger inputStateChanged event(https://github.com/mozilla-b2g/gaia/blob/master/test_apps/demo-keyboard/js/autocorrect.js#L309). "inputStateChanged" will make requestPredictions() clean this.correction to be null. Looks like some call sequence redundant.

I have tried to do "this.reversion = { from: s, to: this.correction.from };" before "inputField.replaceSurroundingText". But it sometime makes auto correction not worked. 

In the other symptom, while the issue is happening, it will receive "inputstatechanged" three times. And the string is become to increase one more space. I might try to trace event receiver in detail.
This bug is blocked by bug 987533. I suggest you not to work on it unless you could provide test cases in the format of bug 987533.
Depends on: 987533
Per offline discussion with Tim, looks like someone is working on the refactor work. Leave assigned status since it's duplicated work now.
Assignee: iliu → nobody
Status: ASSIGNED → NEW
Whiteboard: [keyboard2-feature-parity]
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.