From 93cdbe4b718f9f7a2cd0d6efc545ec51d049812f Mon Sep 17 00:00:00 2001 From: Stephen Kraus <8003332+stephenmk@users.noreply.github.com> Date: Fri, 22 Dec 2023 19:17:17 -0600 Subject: Add support for alt attribute on structured content images (#359) * Add support for alt attribute on structured content images * Add new `alt` property for structured content images * Update test script with new media file count --------- Co-authored-by: stephenmk --- ext/js/display/sandbox/structured-content-generator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ext/js/display/sandbox') diff --git a/ext/js/display/sandbox/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js index a28464ae..ad63667a 100644 --- a/ext/js/display/sandbox/structured-content-generator.js +++ b/ext/js/display/sandbox/structured-content-generator.js @@ -65,6 +65,7 @@ export class StructuredContentGenerator { preferredWidth, preferredHeight, title, + alt, pixelated, imageRendering, appearance, @@ -102,7 +103,7 @@ export class StructuredContentGenerator { imageContainer.appendChild(imageBackground); const image = /** @type {HTMLImageElement} */ (this._createElement('img', 'gloss-image')); - image.alt = ''; + image.alt = typeof alt === 'string' ? alt : ''; imageContainer.appendChild(image); const overlay = this._createElement('span', 'gloss-image-container-overlay'); -- cgit v1.2.3