Merge branch 'next' into next-editor-overhaul
authorAlexander Ebert <ebert@woltlab.com>
Mon, 11 Mar 2019 17:04:46 +0000 (18:04 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 11 Mar 2019 17:04:46 +0000 (18:04 +0100)
1  2 
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js

index 8b0fbd98d0c866c541cdec3bf8e6b192d9ebaf06,2256c2d80dedd885671739d31212870a9f05838b..165b88ac45694d1ea90063bf28026a819c260b45
@@@ -484,24 -482,25 +487,26 @@@ define
                                        
                                        this._notifyCallbacks(containerId, 'open');
                                        
-                                       elAttr(menu, 'role', 'menu');
-                                       elAttr(menu, 'tabindex', -1);
-                                       menu.removeEventListener('keydown', _callbackDropdownMenuKeyDown);
-                                       menu.addEventListener('keydown', _callbackDropdownMenuKeyDown);
 +                                      var firstListItem = null;
-                                       elBySelAll('li', menu, function(listItem) {
-                                               if (firstListItem === null) firstListItem = listItem;
-                                               else if (listItem.classList.contains('active')) firstListItem = listItem;
-                                               
-                                               elAttr(listItem, 'role', 'menuitem');
-                                               elAttr(listItem, 'tabindex', -1);
-                                       });
+                                       if (!disableAutoFocus) {
+                                               elAttr(menu, 'role', 'menu');
+                                               elAttr(menu, 'tabindex', -1);
+                                               menu.removeEventListener('keydown', _callbackDropdownMenuKeyDown);
+                                               menu.addEventListener('keydown', _callbackDropdownMenuKeyDown);
 -                                              var firstListItem = null;
+                                               elBySelAll('li', menu, function (listItem) {
+                                                       if (firstListItem === null) firstListItem = listItem;
+                                                       else if (listItem.classList.contains('active')) firstListItem = listItem;
+                                                       
+                                                       elAttr(listItem, 'role', 'menuitem');
+                                                       elAttr(listItem, 'tabindex', -1);
+                                               });
 -                                              if (firstListItem !== null) {
 -                                                      firstListItem.focus();
 -                                              }
+                                       }
                                        
                                        this.setAlignment(dropdown, menu, alternateElement);
 +                                      
 +                                      if (firstListItem !== null) {
 +                                              firstListItem.focus();
 +                                      }
                                }
                        }).bind(this));