Describe the bug
On /communities/add, pressing Enter in the location search always calls the search, including with an empty query or while a search is already running. The Search button is disabled in both states. The search then sends q= to Nominatim, clears the result list, and forgets an area that was already picked. The query is also interpolated into the Nominatim URL unencoded, so &, # or ? in it change the request.
To Reproduce
- Open /communities/add and wait for the fields to unlock.
- Search for an area and pick a result ("Location selected!").
- Clear the search box and press Enter.
- The picked area is gone and a
q= request went to Nominatim.
Expected behavior
Enter does what the Search button does: nothing while the query is empty or a search is running. Otherwise it runs the search with the query URL-encoded.
Screenshots
Additional context
This predates the inline validation work: main behaves the same. It came up in the review of #1405, which made Enter run only the search (it used to submit the form too). The fix is a guard in searchLocation() plus encodeURIComponent on the query.
Describe the bug
On /communities/add, pressing Enter in the location search always calls the search, including with an empty query or while a search is already running. The Search button is disabled in both states. The search then sends
q=to Nominatim, clears the result list, and forgets an area that was already picked. The query is also interpolated into the Nominatim URL unencoded, so&,#or?in it change the request.To Reproduce
q=request went to Nominatim.Expected behavior
Enter does what the Search button does: nothing while the query is empty or a search is running. Otherwise it runs the search with the query URL-encoded.
Screenshots
Additional context
This predates the inline validation work:
mainbehaves the same. It came up in the review of #1405, which made Enter run only the search (it used to submit the form too). The fix is a guard insearchLocation()plusencodeURIComponenton the query.