Skip to content

RTFDB-4842: Improve user input handling in "mapbox-gl-geocoder" - #556

Open
pahuta wants to merge 2 commits into
RTFDB-4842-improve-user-input-handling-in-mapbox-gl-geocoderfrom
RTFDB-4842-improve-user-input-handling-2
Open

RTFDB-4842: Improve user input handling in "mapbox-gl-geocoder"#556
pahuta wants to merge 2 commits into
RTFDB-4842-improve-user-input-handling-in-mapbox-gl-geocoderfrom
RTFDB-4842-improve-user-input-handling-2

Conversation

@pahuta

@pahuta pahuta commented Aug 2, 2026

Copy link
Copy Markdown
  • Add options.inputTransforms.trimCoordinatesPunctuation option (default false)
  • Extract whitespace trimming into a new private _transformInput() method, called recursively until a pass leaves the input unchanged
  • When enabled, trim leading/trailing punctuation characters from input that looks like coordinates, using a new relaxed utils.RELAXED_COORD_RGX
  • Move default options into a module-level defaultOptions object instead of MapboxGeocoder.prototype.options, and initialize _headers in the constructor
  • Add tests covering the new option's default value, enabled/disabled behavior, recursive trimming, and non-coordinate input

https://mapbox.atlassian.net/browse/RTFDB-4842

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • run npm run docs and commit changes to API.md
  • update CHANGELOG.md with changes under main heading before merging

Previous and still a default behaviour vs new behavior with new config:

semi.mp4

pahuta added 2 commits August 2, 2026 03:41
- Add `options.inputTransforms.trimCoordinatesPunctuation` option (default `false`)
- Extract whitespace trimming into a new private `_transformInput()` method, called recursively until a pass leaves the input unchanged
- When enabled, trim leading/trailing punctuation characters from input that looks like coordinates, using a new relaxed `utils.RELAXED_COORD_RGX`
- Move default options into a module-level `defaultOptions` object instead of `MapboxGeocoder.prototype.options`, and initialize `_headers` in the constructor
- Add tests covering the new option's default value, enabled/disabled behavior, recursive trimming, and non-coordinate input

https://mapbox.atlassian.net/browse/RTFDB-4842
@pahuta
pahuta marked this pull request as ready for review August 5, 2026 09:42
@pahuta
pahuta requested a review from a team as a code owner August 5, 2026 09:42
@pahuta
pahuta requested review from underoot and removed request for a team August 5, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant