[openstreetmap/openstreetmap-website] Add datalist to display multiple search results (PR #6765)
Tom Hughes
notifications at github.com
Sun Feb 1 09:55:26 UTC 2026
@tomhughes commented on this pull request.
> endpoint.setValue(value);
}
+ function findDatalistOption(value) {
+ if (!datalist || !datalist.length) return null;
As we always provide a datalist I don't think this is required? The value should never be null and if the length is zero then we just won't match in the loop?
> @@ -84,6 +109,10 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, marker, dragCallback, cha
delete endpoint.value;
input.val("");
map.removeLayer(endpoint.marker);
+
+ if (datalist && datalist.length) {
Same goes here - datalist should always be set and calling empty on an empty list should be safe?
> + setLatLng(L.latLng(lat, lon));
+ endpoint.value = value;
+ input.val(value);
+ changeCallback();
This is duplicating code in `setValue` so I think we need to share that - could we not just use `setValue` here if we passed in the lat/lon object? Obviously it would then only look for lat/lon in the text if that argument wasn't passed...
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6765#pullrequestreview-3735399416
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6765/review/3735399416 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260201/084615b8/attachment.htm>
More information about the rails-dev
mailing list