Canvas width includes scrollbar on load, but correct after resize
Nobody has claimed this yet.
- 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


### 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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