From 6f61081043f9dcc871ebc9cd3270d22ecd7ffd20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= <elias@haeussler.dev>
Date: Sun, 2 Feb 2020 19:37:49 +0100
Subject: [PATCH] [BUGFIX] Make user avatar buttons accessible via keyboard

Both "clear" and "add" buttons for the backend user avatar selection
are currently not accessible via keyboard. In order to solve this
accessibility issue, both buttons have been converted from links to
html buttons to trigger the onclick handler when using the keyboard.

Resolves: #90293
Releases: master, 9.5
Change-Id: I263a282a4bee33abdb88f9850d230a453365b7ab
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63148
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Michael Telgkamp <michael.telgkamp@mindscreen.de>
Tested-by: Torben Hansen <derhansen@gmail.com>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../setup/Classes/Controller/SetupModuleController.php    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/setup/Classes/Controller/SetupModuleController.php b/typo3/sysext/setup/Classes/Controller/SetupModuleController.php
index 527980e0f4f7..a6179152df02 100644
--- a/typo3/sysext/setup/Classes/Controller/SetupModuleController.php
+++ b/typo3/sysext/setup/Classes/Controller/SetupModuleController.php
@@ -574,17 +574,17 @@ class SetupModuleController
                     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
                     if ($avatarFileUid) {
                         $html .=
-                            '<a id="clear_button_' . htmlspecialchars($fieldName) . '" aria-label="' . htmlspecialchars($this->getLanguageService()->getLL('avatar.clear')) . '" '
+                            '<button type="button" id="clear_button_' . htmlspecialchars($fieldName) . '" aria-label="' . htmlspecialchars($this->getLanguageService()->getLL('avatar.clear')) . '" '
                                 . 'onclick="clearExistingImage(); return false;" class="btn btn-default">'
                                 . $iconFactory->getIcon('actions-delete', Icon::SIZE_SMALL)
-                            . '</a>';
+                            . '</button>';
                     }
                     $html .=
-                        '<a id="add_button_' . htmlspecialchars($fieldName) . '" class="btn btn-default btn-add-avatar"'
+                        '<button type="button" id="add_button_' . htmlspecialchars($fieldName) . '" class="btn btn-default btn-add-avatar"'
                             . ' aria-label="' . htmlspecialchars($this->getLanguageService()->getLL('avatar.openFileBrowser')) . '"'
                             . ' onclick="openFileBrowser();return false;">'
                             . $iconFactory->getIcon('actions-insert-record', Icon::SIZE_SMALL)
-                            . '</a></div>';
+                            . '</button></div>';
 
                     $this->addAvatarButtonJs($fieldName);
                     break;
-- 
GitLab