Improved a11y of upload buttons
authorMarcel Werk <burntime@woltlab.com>
Sat, 9 Mar 2019 18:14:44 +0000 (19:14 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sat, 9 Mar 2019 18:14:44 +0000 (19:14 +0100)
See #2713

wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js

index 71adbda74afaedcdb450a317debc468aeedf99ef..ee3d413abdd63d36df7bc4ff1aec15b443318faf 100755 (executable)
@@ -5944,10 +5944,14 @@ if (COMPILER_TARGET_DEFAULT) {
                                this._fileUpload = $('<input type="file" name="' + this._name + '" ' + (this._options.multiple ? 'multiple="true" ' : '') + '/>');
                                this._fileUpload.change($.proxy(this._upload, this));
                                var $button = $('<p class="button uploadButton"><span>' + WCF.Language.get('wcf.global.button.upload') + '</span></p>');
+                               elAttr($button[0], 'role', 'button');
+                               elAttr($button[0], 'tabindex', '0');
                                $button.prepend(this._fileUpload);
                        }
                        else {
                                var $button = $('<p class="button uploadFallbackButton"><span>' + WCF.Language.get('wcf.global.button.upload') + '</span></p>');
+                               elAttr($button[0], 'role', 'button');
+                               elAttr($button[0], 'tabindex', '0');
                                $button.click($.proxy(this._showOverlay, this));
                        }
                        
index e9cf97a4021edc19cfec6978b9bd7b180b0583f5..bba83d72762b82fe784f9f940902ab817ca8b0b4 100644 (file)
@@ -92,6 +92,8 @@ define(['AjaxRequest', 'Core', 'Dom/ChangeListener', 'Language', 'Dom/Util', 'Do
                        
                        this._button = elCreate('p');
                        this._button.className = 'button uploadButton';
+                       elAttr(this._button, 'role', 'button');
+                       elAttr(this._button, 'tabindex', '0');
                        
                        var span = elCreate('span');
                        span.textContent = Language.get('wcf.global.button.upload');