diff --git a/app/views/avatar/update.php b/app/views/avatar/update.php index c5b87c90dcb8732af321c377bba72fc37bc5ea2e..777c0c7a9cd92148f57079800f03e182f24d2cd9 100644 --- a/app/views/avatar/update.php +++ b/app/views/avatar/update.php @@ -26,7 +26,7 @@ ) ?> </p> - <a onclick="javascript:void 0" class=button><?= _('Auswählen') ?></a> + <a class="button" tabindex="0"><?= _('Auswählen') ?></a> </label> <input type="hidden" name="cropped-image" id="cropped-image" value=""> diff --git a/resources/assets/javascripts/bootstrap/avatar.js b/resources/assets/javascripts/bootstrap/avatar.js index a164ca2ca5929749ee83a71d9397b947d971ed32..b4035e75db5d6d72e07ae05144461cca3c6b4b48 100644 --- a/resources/assets/javascripts/bootstrap/avatar.js +++ b/resources/assets/javascripts/bootstrap/avatar.js @@ -43,4 +43,13 @@ STUDIP.domReady(() => { }); }); } + + //"Redirecting" the event is necessary so that the avatar image upload + //is accessible by pressing the enter key when its focused. + jQuery(document).on('keydown', 'form.settings-avatar label.file-upload a.button', function(event) { + if (event.code == "Enter") { + //The enter key has been pressed. + jQuery(this).parent('.file-upload').trigger('click'); + } + }); });