Force open of first child tab if there are no active ones
authorAlexander Ebert <ebert@woltlab.com>
Tue, 6 Jun 2017 18:18:27 +0000 (20:18 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 6 Jun 2017 18:18:34 +0000 (20:18 +0200)
wcfsetup/install/files/js/WCF.Message.js

index a2d1a498cc246e3399cd099d22dd9b32b9fc7238..b4400286fd8329c64df576712f706cac144fb3b3 100644 (file)
@@ -2156,6 +2156,14 @@ $.widget('wcf.messageTabMenu', {
                                        $current.container.addClass('active');
                                        $target = $current;
                                        
+                                       // if the tab contains a tab menu itself, open the first tab too,
+                                       // unless there is already at least one open tab
+                                       var container = $current.container[0];
+                                       if (elBySel('.messageTabMenuContent.active', container) === null && elBySel('.messageTabMenuContent', container) !== null) {
+                                               var link = elBySel('nav > ul > li[data-name] > a', container);
+                                               if (link !== null) $(link).trigger('mousedown');
+                                       }
+                                       
                                        continue;
                                }
                                else if (forceOpen === true) {