PB-2337: compact overflowing map attributions#1586
Conversation
web-mapviewer
|
||||||||||||||||||||||||||||
| Project |
web-mapviewer
|
| Branch Review |
feat-local-file-attribution-overflow-spec
|
| Run status |
|
| Run duration | 04m 39s |
| Commit |
|
| Committer | Raphael Antonietti |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
19
|
|
|
0
|
|
|
222
|
| View all changes introduced in this branch ↗︎ | |
ltkum
left a comment
There was a problem hiding this comment.
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.
ltkum
left a comment
There was a problem hiding this comment.
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.
c23477d to
3cf56db
Compare
|
Very nice, thanks! 🚀 |
672625b to
3cf56db
Compare
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" |
There was a problem hiding this comment.
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}`)) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
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