PinHint clears MapLibre's credit too, so the pill stops covering it on phones

syncAttribClearance() measured the strip it must clear from Mapbox's credit
(.mapboxgl-ctrl-attrib) and our own (.doxa-attribution), never from MapLibre's
(.maplibregl-ctrl-attrib). MapLibre is the default engine. With no match, the
clearance stayed at the 20px fallback. On a phone the MapLibre credit wraps to two
lines, and the "Tap a coloured dot" pill covered it: a licence-required credit
hidden on every map that mounts the hint.

Measured at 390x844 on DX Life's home page (Prayer Progress), on the shared
browser: MapLibre en and ar, pill over the credit by 35px with the clearance at
20px; Mapbox, clearance 72px and 0px overlap.

The selector now also takes .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib
and the MapLibre form of our own credit line. The existing measure (the strip from
the credit's top to the box's bottom) and its ResizeObserver then apply unchanged.
Proved on the live DOM, inside the map's shadow root: on MapLibre the old selector
finds nothing and the new one finds the credit; on Mapbox both find it.

Library only. Every ProfileLoader consumer needs a rebuild to ship it.
This commit is contained in:
Doxa Maps 2026-09-29 22:03:22 +00:00
parent 30ca27a84f
commit e40077a50c

View file

@ -279,13 +279,17 @@ function syncAttribClearance(root) {
if (!el || !root?.querySelector) return
let h = 0
try {
// TWO attribution flavours ship in this repo and the pill must clear EITHER:
// .mapboxgl-ctrl-attrib — Mapbox's own control (useMapInstance, attributionControl:true)
// .doxa-attribution — our own credit line (useMapAttribution.js) on the profiles
// that construct with attributionControl:false
// Both are licence-required credit, so both are obstacles, never things to cover.
// THREE attribution flavours ship in this repo and the pill must clear ANY of them:
// .mapboxgl-ctrl-attrib — Mapbox's own control (useMapInstance, attributionControl:true)
// .maplibregl-ctrl-attrib — MapLibre's, the DEFAULT engine. Missing from this list, the pill
// kept the 20px fallback and, on a 390px phone where the credit wraps
// to two lines (37px), covered it by 35px on every map. Mapbox measured 0.
// .doxa-attribution — our own credit line (useMapAttribution.js) on the profiles
// that construct with attributionControl:false
// All are licence-required credit, so all are obstacles, never things to cover.
const a = root.querySelector(
'.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl-attrib, .mapboxgl-ctrl-bottom-right .doxa-attribution, .doxa-attribution')
'.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl-attrib, .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib, '
+ '.mapboxgl-ctrl-bottom-right .doxa-attribution, .maplibregl-ctrl-bottom-right .doxa-attribution, .doxa-attribution')
if (a) {
// Measure the strip the control OCCUPIES from the bottom of the box we are anchored
// in, not the control's own height: Mapbox adds a margin inside