[openstreetmap/openstreetmap-website] Replace custom SVG map controls with Bootstrap Icons (Fixes #6681) (PR #6695)

Marwin Hochfelsner notifications at github.com
Wed Jan 14 15:53:41 UTC 2026


@hlfan commented on this pull request.



> +      if (button.classList.contains("maplibregl-ctrl-zoom-in")) {
+        const icon = document.createElement("i");
+        icon.className = "bi bi-plus-lg";
+        button.appendChild(icon);
+      } else if (button.classList.contains("maplibregl-ctrl-zoom-out")) {
+        const icon = document.createElement("i");
+        icon.className = "bi bi-dash-lg";
+        button.appendChild(icon);
+      } else if (button.classList.contains("maplibregl-ctrl-geolocate")) {
+        const icon = document.createElement("i");
+        icon.className = "bi bi-cursor-fill";
+        button.appendChild(icon);
+      }

Let's remove some repetition:

```js
const iconMap={
  "zoom-in": "plus-lg",
  "zoom-out": "dash-lg",
  "geolocate": "cursor-fill"
}
```

```suggestion
      const icon = iconMap[button.className.match(/maplibregl-ctrl-([\w-]+)/)[1]];
      $(button)
        .empty()
        .append(`<i class="maplibregl-ctrl-icon fs-5 bi bi-${icon}"/>`);
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6695#pullrequestreview-3661468291
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6695/review/3661468291 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260114/36f77fdf/attachment.htm>


More information about the rails-dev mailing list