Skip to content

Commit 11f4af7

Browse files
SableRafclaude
andcommitted
Preload and lazy-load info modal banner
Improve load performance and perceived responsiveness for the info modal banner image. Adds loading="lazy" to the banner image in InfoModal.vue and implements preloadBannerImage in MapView.vue which preloads props.bannerImageUrl. The info button now triggers preloading on @mouseenter to reduce delay when opening the modal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e716e6d commit 11f4af7

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

pcd-website/src/components/InfoModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ onUnmounted(() => {
6666
class="info-modal-banner"
6767
alt=""
6868
aria-hidden="true"
69+
loading="lazy"
6970
/>
7071
<div class="info-modal-body">
7172
<h2 class="info-modal-title">{{ t('nav.info_modal_title') }}</h2>

pcd-website/src/components/MapView.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const selectedNode = ref<Node | null>(null);
2323
const listOpen = ref(false);
2424
const infoModalOpen = ref(false);
2525
26+
function preloadBannerImage() {
27+
const url = props.bannerImageUrl;
28+
if (url) new Image().src = url;
29+
}
30+
2631
let mapInstance: import('leaflet').Map | null = null;
2732
let leafletRef: typeof import('leaflet') | null = null;
2833
const markerMap = new Map<string, import('leaflet').Marker>();
@@ -634,6 +639,7 @@ onUnmounted(() => {
634639
<button
635640
id="info-btn"
636641
:aria-label="t('nav.info_button_label')"
642+
@mouseenter="preloadBannerImage"
637643
@click="infoModalOpen = true"
638644
>i</button>
639645
</div>

0 commit comments

Comments
 (0)