Skip to content

PB-2337: compact overflowing map attributions#1586

Open
rotwurstesser wants to merge 5 commits into
developfrom
feat-local-file-attribution-overflow-spec
Open

PB-2337: compact overflowing map attributions#1586
rotwurstesser wants to merge 5 commits into
developfrom
feat-local-file-attribution-overflow-spec

Conversation

@rotwurstesser

@rotwurstesser rotwurstesser commented Jul 2, 2026

Copy link
Copy Markdown

Issue: Local file and layer attributions can pile up in the map footer until they cover the map viewer. See https://swissgeoplatform.atlassian.net/browse/PB-2337\n\nFix: The footer now keeps the first three attribution sources inline and groups additional sources behind a compact +N toggle with a scrollable expanded list. Attribution links keep full titles, local-file disclaimers stay consistent, and the print service attribution payload remains independent from the viewer footer compaction.

Test link

@cypress

cypress Bot commented Jul 2, 2026

Copy link
Copy Markdown

web-mapviewer    Run #6578

Run Properties:  status check passed Passed #6578  •  git commit 3d9d04ae60: PB-2337: keep primary attributions visible
Project web-mapviewer
Branch Review feat-local-file-attribution-overflow-spec
Run status status check passed Passed #6578
Run duration 04m 39s
Commit git commit 3d9d04ae60: PB-2337: keep primary attributions visible
Committer Raphael Antonietti
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 19
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 222
View all changes introduced in this branch ↗︎

@ltkum ltkum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly nitpicking on my part, the work is overall good :)
The CSS is a bit brute-forced. We usually try to use as many pre-defined classes as possible (for Swissgeo this would be tailwind. I believe the mapviewer is using bootstrap but I might be wrong). To be perfectly fair, given the status of the mapviewer, I am fine with your solution CSS wise :).

I'll send the google sheet link to you via slack, and hopefully you'll get the right to edit it soon.

Comment thread packages/mapviewer/src/modules/i18n/locales/de.json
Comment thread packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue Outdated
Comment thread packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue Outdated
Comment thread packages/mapviewer/src/modules/map/components/footer/MapFooterAttributionList.vue Outdated
@rotwurstesser rotwurstesser marked this pull request as ready for review July 3, 2026 13:52

@ltkum ltkum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I see there are PR merges on develop in your commit history, if we can get rid of those, that would be great, but once it's done, I'm happy with this.

@rotwurstesser rotwurstesser force-pushed the feat-local-file-attribution-overflow-spec branch from c23477d to 3cf56db Compare July 6, 2026 05:24
@hansmannj

hansmannj commented Jul 7, 2026

Copy link
Copy Markdown
Member

Very nice, thanks! 🚀
If possible without too large effort, I'd suggest to only compact the attributions for layers that were imported from a local source, as in the underlying issue with the multiple imported local KMLs.
For the other layers (also those exported from external WM(T)S services), I'd leave everything as is.
We have more degrees of freedom in SWISSGEO web-portal. For the mapviewer, I'd not introduce too many changes if not necessary.

@rotwurstesser rotwurstesser force-pushed the feat-local-file-attribution-overflow-spec branch from 672625b to 3cf56db Compare July 7, 2026 14:57
Raphael Antonietti added 2 commits July 8, 2026 09:15
Keep official attribution sources ahead of local file sources when compacting the footer attribution list. Limit inline attribution entries to four and truncate local imported names so long file labels do not cover the map.
Issue: the local-file attribution compaction could hide non-local primary attribution sources behind the overflow toggle when enough primary sources were active.\n\nSolution: keep every primary source inline and apply the overflow count only to local-file sources that exceed the remaining visible slots.
<template>
<div
class="map-footer-attribution"
v-click-outside="closeExpanded"

@hansmannj hansmannj Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess it might make sense to also close on pressing ESC or the like, not only on clicking outside, if that is possible without too large an effort

const expandedSources = computed(() => localSources.value.slice(visibleLocalSourceCount.value))
const hiddenSourceCount = computed(() => expandedSources.value.length)
const isCompact = computed(() => hiddenSourceCount.value > 0)
const toggleButtonText = computed(() => (isExpanded.value ? '-' : `+${hiddenSourceCount.value}`))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, when expanded, we should display an x rather than -?
Picky, I know, sorry. And also probably a matter of personal test, not really super important 😉

})
})

const VISIBLE_SOURCE_COUNT = 4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine in this mapviewer context!

Idea for SWISSGEO: Rather than a hardcoded number of attributions, we might consider the relative width of the attributions list. So e.g. 6 short attributions are ok, while 4 longer ones would already be compacted. Also, we can make this responsive and treat differently depending on the kind of the device / available screen width

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have places within the mapviewer where we automatically truncate and add a small tooltip which contains the full string (for example: title features). We could use a similar approach to have a character limit, be a bit smart about it to avoid cutting an attribution in the middle, and have it be our trigger to see if we need to truncate the attribution list or not.

@hansmannj hansmannj Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we keep it as in this PR for the mapviewer.
Any more advanced logic, including responsiveness and the like, is for SWISSGEO's we-portal. And in SWISSGEO we also discuss this with the UX team

@ltkum ltkum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, we can go as it is. If you would like to adress @hansmannj suggestions regarding the ESC, I will make a quick check before we merge. With that being said, I would advise against it.

Since we're clicking on the attribution footer to expand it, and any click anywhere else than within it (or a click on the - / x button) would close the expanded list, I don't think this is necessary to add another way to close it, and there is another side effect

We used to have a lot of keyboard shortcuts in the old mapviewer and we got rid of almost all of them because key presses to do some functions are often unintuitive, and often very loosely documented (if I remember well, it was possible to press ctrl+d to open the drawing mode, for example... but this is a memory from long ago ^^).

The only one we still have is on the ESC key, which stop "fullscreen" mode. Adding this would add a situation where using it to close the attribution expanded list would also close the fullscreen mode of the app if it was activated.

Using other keyboards inputs than ESC to close something would be counter intuitive for users, and we would have a side effect with two functions tied to the same touch.

@hansmannj , what are your thoughts on this ?

:source-url="source.url"
:has-data-disclaimer="true"
:is-last="index === sources.length - 1"
:is-last="!isCompact && index === inlineSources.length - 1"

@hansmannj hansmannj Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the !isCompact check here?
How about simply :is-last="index === inlineSources.length - 1"
This would probably prevent a trailing , such as currently observed in Source A, Source B, +3
But this is also a picky comment, sorry.
If we cannot get rid of the traling comma with low effort, then we let it stay there.

@hansmannj hansmannj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks a ton 🚀
Only some minor comments, low prio.

Only question:

  • might make sense to add some simple test cases for this new compaction functionality
  • also we should make sure, that no existing tests rely on a logic, that is now changed due to introducing the new compaction functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants