From 8c40ce022bb0354fdc00fdb9ee9e614009d5455b Mon Sep 17 00:00:00 2001
From: Christian Rath-Ulrich <christian@rath-ulrich.de>
Date: Mon, 20 Nov 2023 19:54:02 +0100
Subject: [PATCH] [TASK] Exclude thumbnails from screen readers in file list
 module

In the file list module, a file thumbnail does not contain
alternative text. To exclude these thumbnails from screen
readers and thus improve accessibility, an empty `alt`
tag is set. This applies to both the list and tile view.

Resolves: #102416
Releases: main, 12.4
Change-Id: Iaf0ce6736f669c0852f96c022fa55c128aecdb9e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82374
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
---
 typo3/sysext/filelist/Classes/FileList.php                     | 3 ++-
 .../filelist/Resources/Private/Templates/Filelist/Tiles.html   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php
index 29ebd53021b6..0225494f0066 100644
--- a/typo3/sysext/filelist/Classes/FileList.php
+++ b/typo3/sysext/filelist/Classes/FileList.php
@@ -658,7 +658,8 @@ class FileList
             'width="' . htmlspecialchars($processedFile->getProperty('width')) . '" ' .
             'height="' . htmlspecialchars($processedFile->getProperty('height')) . '" ' .
             'title="' . htmlspecialchars($resourceView->getName()) . '" ' .
-            'loading="lazy"/>';
+            'loading="lazy" ' .
+            'alt="" />';
     }
 
     /**
diff --git a/typo3/sysext/filelist/Resources/Private/Templates/Filelist/Tiles.html b/typo3/sysext/filelist/Resources/Private/Templates/Filelist/Tiles.html
index 90a4235972fe..196653e16b07 100644
--- a/typo3/sysext/filelist/Resources/Private/Templates/Filelist/Tiles.html
+++ b/typo3/sysext/filelist/Resources/Private/Templates/Filelist/Tiles.html
@@ -65,7 +65,7 @@
                     <f:if condition="{displayThumbs} && {resource.preview}">
                         <f:then>
                             <span class="resource-tile-image">
-                                <f:image image="{resource.preview}" maxHeight="115" maxWidth="166" additionalAttributes="{draggable: 'false'}" loading="lazy" />
+                                <f:image image="{resource.preview}" maxHeight="115" maxWidth="166" additionalAttributes="{draggable: 'false'}" loading="lazy" alt="" />
                             </span>
                         </f:then>
                         <f:else>
-- 
GitLab