mapbox / mapbox/mapbox-gl-js

Canvas width includes scrollbar on load, but correct after resize

Open
#9,883 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: v1.11.1

**browser**: Chrome 83.0.4103.116 (Official Build) (64-bit)

### Steps to Trigger Behavior

1. Load map in a full-width element
2. Check size difference of map container and map canvas
3. After resize, the canvas width gets set correctly

### Link to Demonstration
![canvas size scrollbar included](https://user-images.githubusercontent.com/17144089/87998645-ca1fc000-caf8-11ea-8020-e22f41fe92d2.JPG)
![map container size without scrollbar](https://user-images.githubusercontent.com/17144089/87998648-cb50ed00-caf8-11ea-9a0f-99ef48ecf725.JPG)

### Expected Behavior
Canvas width set correctly for first time without the need to trigger resize
### Actual Behavior
Canvas includes scrollbar width, only gets correct size after resize event

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 in Chrome 83 using the described full-width map setup and the linked demonstration, then compare the initial canvas and map-container widths before and after resize. Trace the initial sizing path and verify that the canvas width excludes the scrollbar on first load without requiring a resize event.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.