When search markers are visible, clear search on map click

This commit is contained in:
2026-06-30 18:32:23 +02:00
parent 59e334c499
commit 7f1c4b5f61
2 changed files with 8 additions and 7 deletions

View File

@@ -1191,6 +1191,12 @@ export default class MapComponent extends Component {
return;
}
if (this.mapUi.searchResults && this.mapUi.searchResults.length > 0) {
console.debug('Clearing active search and markers on map click');
this.router.transitionTo('index');
return;
}
// Require Zoom >= 17 for generic map searches
// This prevents accidental searches when interacting with the map at a high level
const currentZoom = this.mapInstance.getView().getZoom();

View File

@@ -101,7 +101,7 @@ module('Acceptance | map search reset', function (hooks) {
'Should have stayed on the search route with markers intact'
);
// Second Click (Start new search)
// Second Click (Clear search and markers)
// Click slightly differently to ensure fresh event
await triggerEvent(canvas, 'pointerdown', {
clientX: 250,
@@ -125,11 +125,6 @@ module('Acceptance | map search reset', function (hooks) {
// 3. Wait for transition
await new Promise((r) => setTimeout(r, 1000));
const newUrl = currentURL();
assert.notOk(
newUrl.includes('category=coffee'),
`New URL ${newUrl} should not contain category param`
);
assert.ok(newUrl.includes('/search'), 'Should be on search route');
assert.strictEqual(currentURL(), '/', 'Should have transitioned to index');
});
});