mapbox / mapbox/mapbox-gl-directions

Origin and Destination input boxes stay opened when setOrigin/setDestination are called twice.

Open
#327 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
255
Forks
130
PR merge metrics
No merged PRs in 30d

Description

Hi.

When setOrigin or setDestination are called 2 or more times input boxes stay opened, suggesting to select a location. I would like to behave as if it was initially set.

Example is here:
https://jsfiddle.net/etfg3d46/2/

Screenshot:

Image

```
map.on('load', function() {
map.addControl(directionsControl, 'top-left');
directionsControl.setDestination("Philadelphia");
directionsControl.setOrigin("New York");

setTimeout(() => {
directionsControl.setDestination("Chicago, Illinois, United States");
}, 2500);
setTimeout(() => {
directionsControl.setOrigin("Washington");
}, 5000);
});
```

It doesn't happen when I pass coordinates, but I would like to see place names instead of numbers in input boxes.

Any workarounds to keep it closed?

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 issue with the linked JSFiddle and then inspect the setOrigin and setDestination entry points in the directions control. Verify repeated geocoded calls and coordinate calls separately; done means the input boxes close after repeated calls while retaining the place names.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.