mapbox / mapbox/mapbox-gl-geocoder

Wrong item selected in autocomplete on chrome android

Open
#357 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
388
Forks
181
PR merge metrics
No merged PRs in 30d

Description

Hello,

I encountered a weird bug on Android on the autocomplete: when you scroll in your page then click on a suggestion item, the selected item that is put in the field is not the one you pressed on, but the one that was originally at this position before scrolling.

You can easily reproduce that faulty behavior on the official docs example: https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/

Exact steps:

- start typing in the field
- the autocomplete displays the suggestions
- keep in mind the position of the first result on your screen then scroll a bit to position another result in the same location
- press on the other result
- the first result is selected, not the one you pressed

This doesn't happen in a chrome desktop browser.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the official Mapbox GL Geocoder example on Chrome Android using the listed scroll-and-select steps, then trace the autocomplete suggestion click handling. The fix is done when the item pressed after scrolling is selected, while desktop Chrome behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.