From 8caf13e5d5ba39c7dc1efac4d8e96fd3bcc40044 Mon Sep 17 00:00:00 2001 From: Sped0n Date: Fri, 3 Nov 2023 09:55:32 +0800 Subject: [PATCH] fix(stage.ts, collection.ts, gallery.ts, resources.ts): set the alt attribute of the image element to the value of the alt property in the ImageJSON object to improve accessibility and provide alternative text for images. --- assets/ts/desktop/stage.ts | 2 +- assets/ts/mobile/collection.ts | 2 +- assets/ts/mobile/gallery.ts | 2 +- assets/ts/resources.ts | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/ts/desktop/stage.ts b/assets/ts/desktop/stage.ts index ef09338..b6a9fc7 100644 --- a/assets/ts/desktop/stage.ts +++ b/assets/ts/desktop/stage.ts @@ -267,7 +267,7 @@ function createStage(ijs: ImageJSON[]): void { e.dataset.loUrl = ij.loUrl e.dataset.loImgH = ij.loImgH.toString() e.dataset.loImgW = ij.loImgW.toString() - e.alt = 'image' + e.alt = ij.alt stage.append(e) } container.append(stage) diff --git a/assets/ts/mobile/collection.ts b/assets/ts/mobile/collection.ts index e8cae54..261bb5d 100644 --- a/assets/ts/mobile/collection.ts +++ b/assets/ts/mobile/collection.ts @@ -86,7 +86,7 @@ function createCollection(ijs: ImageJSON[]): void { e.dataset.src = ij.loUrl e.height = ij.loImgH e.width = ij.loImgW - e.alt = 'image' + e.alt = ij.alt e.style.transform = `translate3d(${x}%, ${y - 50}%, 0)` _collection.append(e) } diff --git a/assets/ts/mobile/gallery.ts b/assets/ts/mobile/gallery.ts index 9a35e08..86ead48 100644 --- a/assets/ts/mobile/gallery.ts +++ b/assets/ts/mobile/gallery.ts @@ -195,7 +195,7 @@ function createGallery(ijs: ImageJSON[]): void { e.dataset.src = ij.hiUrl e.height = ij.hiImgH e.width = ij.hiImgW - e.alt = 'image' + e.alt = ij.alt // append _swiperSlide.append(e) _swiperWrapper.append(_swiperSlide) diff --git a/assets/ts/resources.ts b/assets/ts/resources.ts index f57f5a5..1adbb21 100644 --- a/assets/ts/resources.ts +++ b/assets/ts/resources.ts @@ -1,6 +1,7 @@ // data structure for images info export interface ImageJSON { index: number + alt: string loUrl: string loImgH: number loImgW: number