Changed role of nav/article elements without label to presentation
authorMarcel Werk <burntime@woltlab.com>
Sun, 7 Oct 2018 08:59:25 +0000 (10:59 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 7 Oct 2018 08:59:25 +0000 (10:59 +0200)
See #2713

wcfsetup/install/files/js/WoltLabSuite/Core/Bootstrap.js

index 733269da132f239fdd81c4ea1a3f0f14136afd0b..f3ed91268a3d6d7985a749692bce666ffa68c890 100644 (file)
@@ -14,14 +14,14 @@ define(
                'Ui/SimpleDropdown',       'WoltLabSuite/Core/Ui/Mobile',  'WoltLabSuite/Core/Ui/TabMenu', 'WoltLabSuite/Core/Ui/FlexibleMenu',
                'Ui/Dialog',               'WoltLabSuite/Core/Ui/Tooltip', 'WoltLabSuite/Core/Language',   'WoltLabSuite/Core/Environment',
                'WoltLabSuite/Core/Date/Picker', 'EventHandler',           'Core',                   'WoltLabSuite/Core/Ui/Page/JumpToTop',
-               'Devtools'
+               'Devtools', 'Dom/ChangeListener'
        ], 
        function(
                 favico,                   enquire,                  perfectScrollbar,         DateTimeRelative,
                 UiSimpleDropdown,         UiMobile,                 UiTabMenu,                UiFlexibleMenu,
                 UiDialog,                 UiTooltip,                Language,                 Environment,
                 DatePicker,               EventHandler,             Core,                     UiPageJumpToTop,
-                Devtools
+                Devtools, DomChangeListener
        )
 {
        "use strict";
@@ -97,6 +97,19 @@ define(
                                        window.jQuery.holdReady(false);
                                }
                        }, 20);
+                       
+                       this._initA11y();
+                       DomChangeListener.add('WoltLabSuite/Core/Bootstrap', this._initA11y.bind(this));
+               },
+               
+               _initA11y: function() {
+                       elBySelAll('nav:not([aria-label]):not([role])', undefined, function(element) {
+                               elAttr(element, 'role', 'presentation');
+                       });
+                       
+                       elBySelAll('article:not([aria-label]):not([role])', undefined, function(element) {
+                               elAttr(element, 'role', 'presentation');
+                       });
                }
        };
 });