From 54626178d1fa80dfa9539b31f54b7433c5aefbca Mon Sep 17 00:00:00 2001 From: Raphael Antonietti Date: Thu, 2 Jul 2026 17:59:10 +0200 Subject: [PATCH 1/5] PB-2337: compact overflowing map attributions --- .../src/modules/i18n/locales/de.json | 3 + .../src/modules/i18n/locales/en.json | 3 + .../src/modules/i18n/locales/fr.json | 3 + .../src/modules/i18n/locales/it.json | 3 + .../src/modules/i18n/locales/rm.json | 3 + .../footer/MapFooterAttributionItem.vue | 2 + .../footer/MapFooterAttributionList.vue | 160 ++++++++++++++++-- 7 files changed, 166 insertions(+), 11 deletions(-) diff --git a/packages/mapviewer/src/modules/i18n/locales/de.json b/packages/mapviewer/src/modules/i18n/locales/de.json index d0ab0eb2de..be33c84c11 100644 --- a/packages/mapviewer/src/modules/i18n/locales/de.json +++ b/packages/mapviewer/src/modules/i18n/locales/de.json @@ -27,6 +27,9 @@ "appcache_update_available": "Neue Version der Offline Funktion verfügbar. Wollen Sie sie laden?", "approx_abbr": "ca.", "are": "ARE", + "attribution_overflow_hide_sources": "Weitere Quellenangaben ausblenden", + "attribution_overflow_show_source": "Eine weitere Quellenangabe anzeigen", + "attribution_overflow_show_sources": "{count} weitere Quellenangaben anzeigen", "are_service_link_href": "http://www.are.admin.ch/index.html?lang=de", "are_service_link_label": "www.are.admin.ch", "area": "Fläche", diff --git a/packages/mapviewer/src/modules/i18n/locales/en.json b/packages/mapviewer/src/modules/i18n/locales/en.json index 456214aa50..dc82b2b898 100644 --- a/packages/mapviewer/src/modules/i18n/locales/en.json +++ b/packages/mapviewer/src/modules/i18n/locales/en.json @@ -27,6 +27,9 @@ "appcache_update_available": "A new version of offline function is available. Load it?", "approx_abbr": "approx.", "are": "ARE", + "attribution_overflow_hide_sources": "Hide additional attribution sources", + "attribution_overflow_show_source": "Show 1 more attribution source", + "attribution_overflow_show_sources": "Show {count} more attribution sources", "are_service_link_href": "http://www.are.admin.ch/index.html?lang=en", "are_service_link_label": "www.are.admin.ch", "area": "Area", diff --git a/packages/mapviewer/src/modules/i18n/locales/fr.json b/packages/mapviewer/src/modules/i18n/locales/fr.json index d7ed9f75bb..826fb33f2c 100644 --- a/packages/mapviewer/src/modules/i18n/locales/fr.json +++ b/packages/mapviewer/src/modules/i18n/locales/fr.json @@ -27,6 +27,9 @@ "appcache_update_available": "Une mise à jour du site est disponible. Voulez-vous l'utiliser?", "approx_abbr": "env.", "are": "ARE", + "attribution_overflow_hide_sources": "Masquer les autres sources d'attribution", + "attribution_overflow_show_source": "Afficher une autre source d'attribution", + "attribution_overflow_show_sources": "Afficher {count} autres sources d'attribution", "are_service_link_href": "http://www.are.admin.ch/index.html?lang=fr", "are_service_link_label": "www.are.admin.ch", "area": "Aire", diff --git a/packages/mapviewer/src/modules/i18n/locales/it.json b/packages/mapviewer/src/modules/i18n/locales/it.json index 9e95c5750e..eaf927f098 100644 --- a/packages/mapviewer/src/modules/i18n/locales/it.json +++ b/packages/mapviewer/src/modules/i18n/locales/it.json @@ -27,6 +27,9 @@ "appcache_update_available": "È a disposizione un aggiornamento del sito. Desiderate utilizzarlo?", "approx_abbr": "ca.", "are": "ARE", + "attribution_overflow_hide_sources": "Nascondi altre fonti di attribuzione", + "attribution_overflow_show_source": "Mostra un'altra fonte di attribuzione", + "attribution_overflow_show_sources": "Mostra altre {count} fonti di attribuzione", "are_service_link_href": "http://www.are.admin.ch/index.html?lang=it", "are_service_link_label": "www.are.admin.ch", "area": "Zona", diff --git a/packages/mapviewer/src/modules/i18n/locales/rm.json b/packages/mapviewer/src/modules/i18n/locales/rm.json index 62af07c544..43985511c3 100644 --- a/packages/mapviewer/src/modules/i18n/locales/rm.json +++ b/packages/mapviewer/src/modules/i18n/locales/rm.json @@ -27,6 +27,9 @@ "appcache_update_available": "Ina nova versiun stat a disposiziun offline. La vulais Vus chargiar giu?", "approx_abbr": "ca.", "are": "ARE", + "attribution_overflow_hide_sources": "Zuppentar ulteriuras funtaunas d'attribuziun", + "attribution_overflow_show_source": "Mussar ina ulteriura funtauna d'attribuziun", + "attribution_overflow_show_sources": "Mussar {count} ulteriuras funtaunas d'attribuziun", "are_service_link_href": "http://www.are.admin.ch/index.html?lang=de", "are_service_link_label": "www.are.admin.ch", "area": "Surfatscha", diff --git a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionItem.vue b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionItem.vue index debfb814a9..b213ffc1d6 100644 --- a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionItem.vue +++ b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionItem.vue @@ -29,9 +29,11 @@ const { sourceId, sourceName, sourceUrl, hasDataDisclaimer, isLast } = definePro :id="`source-${sourceId}`" :href="sourceUrl" :target="sourceUrl ? '_blank' : null" + :rel="sourceUrl ? 'noopener noreferrer' : null" class="map-footer-attribution-source clear-no-ios-long-press" :class="{ 'text-primary': hasDataDisclaimer, 'is-link': sourceUrl || hasDataDisclaimer }" :data-cy="`layer-copyright-${sourceName}`" + :title="sourceName" > {{ `${sourceName}${isLast ? '' : ','}` }} diff --git a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue index b8458dec37..84d4f059e4 100644 --- a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue +++ b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue @@ -1,5 +1,5 @@ @@ -96,5 +175,64 @@ const sources = computed(() => { text-align: center; position: relative; pointer-events: all; + display: inline-flex; + flex-wrap: wrap; + align-items: center; + max-width: calc(100vw - 0.5rem); +} + +.map-footer-attribution-inline-item { + display: inline-flex; + min-width: 0; +} + +.map-footer-attribution-toggle { + margin-left: 2px; + padding: 0 0.35rem; + border: 1px solid rgba($black, 0.25); + border-radius: 0.2rem; + background: rgba($white, 0.85); + color: $black; + font: inherit; + line-height: 1.2; + + &:hover { + text-decoration: underline; + } + + &:focus-visible { + outline: 2px solid $primary; + outline-offset: 2px; + } +} + +.map-footer-attribution-expanded-list { + position: absolute; + right: 0; + bottom: calc(100% + 0.25rem); + z-index: $zindex-desktop-footer-infobox; + display: flex; + flex-direction: column; + gap: 0.15rem; + max-width: min(24rem, calc(100vw - 1rem)); + max-height: 30vh; + padding: 0.4rem 0.6rem; + overflow-y: auto; + background: rgba($white, 0.97); + border: 1px solid rgba($black, 0.15); + border-radius: 0.2rem; + box-shadow: 0 2px 6px rgba($black, 0.2); + text-align: left; + white-space: normal; +} + +.map-footer-attribution-expanded-list-hidden { + display: none; +} + +.map-footer-attribution-expanded-item { + display: flex; + min-width: 0; + line-height: 1.45; } From 5224bb03abb8985b52aff5a226405a09cb5c5e7e Mon Sep 17 00:00:00 2001 From: Raphael Antonietti Date: Fri, 3 Jul 2026 15:06:29 +0200 Subject: [PATCH 2/5] PB-2337: address PR review feedback --- .../components/footer/MapFooterAttributionList.vue | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue index 84d4f059e4..f054fac955 100644 --- a/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue +++ b/packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue @@ -53,12 +53,8 @@ const isCompact = computed(() => sources.value.length > COMPACT_SOURCE_COUNT) const hiddenSourceCount = computed(() => isCompact.value ? sources.value.length - COMPACT_SOURCE_COUNT : 0 ) -const inlineSources = computed(() => - isCompact.value ? sources.value.slice(0, COMPACT_SOURCE_COUNT) : sources.value -) -const expandedSources = computed(() => - isCompact.value ? sources.value.slice(COMPACT_SOURCE_COUNT) : [] -) +const inlineSources = computed(() => sources.value.slice(0, COMPACT_SOURCE_COUNT)) +const expandedSources = computed(() => sources.value.slice(COMPACT_SOURCE_COUNT)) const toggleButtonText = computed(() => (isExpanded.value ? '-' : `+${hiddenSourceCount.value}`)) const expandButtonLabel = computed(() => { @@ -129,8 +125,8 @@ function toggleExpanded() {