mapbox / mapbox/mapbox-gl-geocoder

if clearOnBlur:true, relatedTarget returns null when clicking on suggestions list

Open
#258 0 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

What I'm trying to do:
- if `clearOnBlur:true`, and the `relatedTarget` on the blur event is the suggestions list, do not clear.

What happens instead:
- in the blur event, relatedTarget is `null` if user clicks on suggestions list.

Why?
- There is an event listener in `suggestions` that removes the suggestions list on selection, before the blur event occurs.

Suggested fix:
- Allow mapbox-gl-geocoder to override the event handling in `suggestions`, or add an option to `suggestions` that does not clear the list on selection.

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

Start by reproducing the blur behavior with clearOnBlur:true while clicking the suggestions list, then inspect the suggestions event listener and the blur event handling described in the issue. Done means selecting a suggestion no longer removes the list before the blur event can use its relatedTarget, while preserving the intended clearOnBlur behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.