commit 2e93d5dacb866c2c0600cb66655086c93a4f92f5
parent defdeea6f6d566f66bed04b67c16ff86a41740ef
Author: Hunter
Date: Mon, 6 Jul 2026 13:40:46 -0400
allow open in new tab when cmd+clicking markers
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/resources/map.js b/resources/map.js
@@ -87,10 +87,10 @@
var d = fmt.parseLocal(m.start);
return L.divIcon({
className: "",
- html: "<div class=\"event-pin\" style=\"background:" + m.color + "\">" +
+ html: "<a class=\"event-pin\" href=\"" + fmt.eventUrl(m) + "\" style=\"background:" + m.color + "\">" +
"<span class=\"pin-month\">" + fmt.MONTH_ABBR[d.getMonth()] + "</span>" +
"<span class=\"pin-day\">" + d.getDate() + "</span>" +
- "</div>",
+ "</a>",
iconSize: [48, 48],
iconAnchor: [24, 24]
});
@@ -116,14 +116,18 @@
}
events.forEach(function (m, i) {
- var marker = L.marker([m.latitude, m.longitude], { icon: makeIcon(m) }).addTo(map);
+ // keyboard:false so Leaflet doesn't add its own tabIndex/role to the icon root.
+ // the inner <a> is the focusable, Enter-activatable element (no double tab stop)
+ var marker = L.marker([m.latitude, m.longitude], { icon: makeIcon(m), keyboard: false }).addTo(map);
marker.setZIndexOffset((events.length - i) * Z_STEP);
m._marker = marker; // so selectEvent can reach this pin's DOM
- marker.on("click", function () { selectMarker(m, true); });
- // Leaflet gives focused markers tabIndex + role=button but only wires Enter for
- // popups, so activate the pin ourselves (13 = Enter, matching Leaflet's own idiom)
- marker.on("keypress", function (e) {
- if (e.originalEvent.keyCode === 13) { selectMarker(m, true); }
+ marker.on("click", function (e) {
+ // modified clicks (new tab/window) fall through to the anchor's native nav;
+ // plain clicks + keyboard Enter select in-page instead of navigating
+ var oe = e.originalEvent;
+ if (oe.metaKey || oe.ctrlKey || oe.shiftKey || oe.altKey) { return; }
+ oe.preventDefault();
+ selectMarker(m, true);
});
});
diff --git a/resources/styles.css b/resources/styles.css
@@ -385,13 +385,16 @@ html, body {
justify-content: center;
font-family: -apple-system, Arial, Helvetica, sans-serif;
line-height: 1.1;
- color: black;
+ text-decoration: none;
text-align: center;
box-shadow: 0 1px 3px #00000040;
cursor: pointer;
border-radius: 0;
transition: border-radius 150ms ease-in-out;
}
+.event-pin:link, .event-pin:visited {
+ color: black;
+}
.event-pin.active {
border-radius: 50%;
}