fenix
fenix copied to clipboard
[Bug]: Backspace applied to autocomplete erases an extra letter
Steps to reproduce
- Open a blank tab.
- Put the cursor in the address bar.
- Type
inst. In my case:- The autocomplete suggestion is
instagram.com - The cursor selection highlights the trailing
agram.com
- The autocomplete suggestion is
- Press backspace once.
Expected behaviour
Backspace erases agram.com (exactly as highlighted), leaving inst.
(This is how backspace on desktop Firefox behaves.)
Actual behaviour
Backspace erases tagram.com (one more letter than highlighted), leaving only ins.
https://user-images.githubusercontent.com/48375680/168629588-42a68aa6-3158-4faa-b9bd-ac9dd1ec998a.mp4
Device name
Google Pixel 6
Android version
Android 12
Firefox release type
Firefox
Firefox version
100.1.1
Device logs
No response
Additional information
No response
┆Issue is synchronized with this Jira Task
not reproducible 102.0a1 (Build #2015880275), 2af9e832c+
have you tried updating to a more recent mainline build of Fenix nightly?
please note fennec is not necessarily the same in functionality and quality as the main branch, as it principally depends on the patches and further alterations by the maintainers. Kindly file bugs that are unique to fennec, after your careful inspection, with their own maintainers.
I am observing the unwanted erasure even on Nightly 102.0a1 (Build #2015880867), 09a9a2252+:
https://user-images.githubusercontent.com/48375680/168733381-17c80cca-8da9-49fd-90ed-920cafdde170.mp4
Hi @yawnoc! Thanks for the report! I couldn't reproduce this issue with a similar device, on the latest builds:
- latest Release (RC100.2.0).
- latest Beta (101.0.0-beta5).
- latest Nightly 102.0a1 (2022-05-17).
Devices used:
- Google Pixel 4 (Android 12).
- Google Pixel 6 (Android 12).
Could you try this again after clearing your browsing data? Thank you!
I am observing the unwanted erasure even on Nightly 102.0a1 (Build #2015880867), 09a9a22+: signal-2022-05-17-08-48-26-616.mp4
Consider swapping the keyboard and trying again, try one of the open-source alternatives or a commercial variant from the Play Store, the choice is plenty.
I can confirm that on other keyboards (e.g. FlorisBoard), the expected behaviour is observed.
But this is because, those keyboards implement backspace by emulating a hardware key event (using InputConnection.sendKeyEvent with KeyEvent.KEYCODE_DEL). This is not good practice, as
[...] it's discouraged to send such key events in normal operation; this is mainly for use with
InputType.TYPE_NULLtype text fields. Use thecommitText(CharSequence, int)family of methods to send text to the application instead.
Now, on the keyboard in the above screen captures (Stroke Input Method v0.9.11), an extra character is erased because selection = inputConnection.getSelectedText(0) results in an empty string in the following snippet:
final CharSequence selection = inputConnection.getSelectedText(0);
if (TextUtils.isEmpty(selection))
{
inputConnection.deleteSurroundingTextInCodePoints(1, 0);
}
else
{
inputConnection.commitText("", 1);
}
https://github.com/stroke-input/stroke-input-android/blob/f86b869afa000f91aa21d5f3fce7276e596c791d/app/src/main/java/io/github/yawnoc/strokeinput/StrokeInputService.java#L567-L575
I believe this is because, when Firefox generates the autocompletion, it isn't actually registered as a selection to the InputConnection. So as far as the keyboard / input method service can tell, nothing is selected, and therefore backspace causes a backwards deletion (instead of deleting the autocompletion).
Furthermore, I suspect this might be the cause of Bug #23709, where a keyboard's word-completion gets inserted before Firefox's autocompletion, instead of replacing Firefox's autocompletion.
I have this issue with fcitx5-android (completion disabled) too. I have to disable completion and type an extra character before deleting Fenix's completion to work around this and https://github.com/mozilla-mobile/fenix/issues/23709.
I considered to disable Fenix's URL completion but if I did that, I would almost have to type every URL entirely because history completion (the URLs showing above the URL bar) sucks and never shows what I expect like Firefox desktop's.
Moved to bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1812233
Change performed by the Move to Bugzilla add-on.