mapbox / mapbox/mapbox-gl-js

Regression in Popup:normalizeOffset()

Open
#13,457 1 comment 0 reactions 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

While migrating from Mapbox v1 to v3 I stumbled over this regression that throws a reference error in the following line:

https://github.com/mapbox/mapbox-gl-js/blob/87938fb284bf9f2c4b1bbbc7baaad074438ae014/src/ui/popup.ts#L723

The regression was introduced in https://github.com/mapbox/mapbox-gl-js/commit/69a888cf303c6b683a7c920eac64e6d4862b9871 by removing this line and setting the default directly in the function parameter:

if (!offset) offset = (new Point(0, 0));

When calling the function with offset = null it throws, where it used to gracefully return the default offset.

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 in src/ui/popup.ts at Popup:normalizeOffset(), especially the line linked in the issue, and review the migration commit that changed the default handling. Verify the null-offset case and confirm that it returns the default Point(0, 0) without a reference error. Add or update the relevant regression test if the surrounding test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.