Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Does not load traffic layer by default

Open
#9 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by locating the MapboxTraffic control and its handling of the showTraffic option, then reproduce the issue with the map initialization snippet in this report. Done means traffic is visible immediately after the map loads with showTraffic enabled, without pressing the traffic button twice.

Written by the indexing model from the issue text.

Description

This can not show traffic by default, I have to press the traffic button twice to cycle it. there does not seem to be a working method to show traffic on load.

My code looks like this:

mapboxgl.accessToken = 'redacted_privatekey_'; var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/streets-v11', zoom: 8, center: [-122, 47.8], }); map.on('load', function() { map.addControl(new mapboxgl.NavigationControl()); map.addControl(new MapboxTraffic({showTraffic: true})); });

Dominant language
JavaScript
Stars
109
Forks
36
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from mapbox/mapbox-gl-traffic

All issues in mapbox/mapbox-gl-traffic

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.