diff --git a/library/components/legends/LegendMobile.vue b/library/components/legends/LegendMobile.vue index bbcc6f647..279313d5e 100644 --- a/library/components/legends/LegendMobile.vue +++ b/library/components/legends/LegendMobile.vue @@ -868,8 +868,8 @@ onBeforeUnmount(() => { // map's first drag. On a phone that drag may never come, and the expanded credit then runs across the top of // the map for good, under the map's own top overlays. So CREDIT_FOLD_MS after it first shows expanded, fold it the way the engine's drag does (drop the // -compact-show class); a tap on the (i) still expands it. The map may still be loading its style when the -// sheet mounts, so look every half second, for up to 30 s; stop once the credit is there and folded (a drag -// or a tap got there first) or is not compact at this width. +// sheet mounts, and an engine may mark it compact only after the map is ready, so look every half second, for +// up to 30 s; stop once the credit is compact and folded (a drag or a tap got there first). const CREDIT_FOLD_MS = 3000 let _creditTimer = 0 function watchCredit(triesLeft) { @@ -883,7 +883,7 @@ function watchCredit(triesLeft) { return } const credit = root.querySelector('.maplibregl-ctrl-attrib, .mapboxgl-ctrl-attrib') - if (credit && !/attrib-empty/.test(credit.className)) return + if (credit && /(maplibregl|mapboxgl)-compact(\s|$)/.test(credit.className)) return if (triesLeft > 0) _creditTimer = setTimeout(() => watchCredit(triesLeft - 1), 500) } onMounted(() => watchCredit(60))