[BUGFIX] Module menu clicks with slow connections opens standalone module 10/53010/2
authorOliver Hader <oliver@typo3.org>
Thu, 1 Jun 2017 13:57:50 +0000 (15:57 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 1 Jun 2017 20:52:01 +0000 (22:52 +0200)
If loading the backend using a slow internet connection an early click on
any item in the module menu on the left side causes the link to be opened
directly. The reason is, that JavaScript and thus click handlers are not
completely loaded yet. Thus, the regular DOM behavior of anchor tags is
executed.

To circumvent this behavior, href-arguments have to be disabled and the
module URL moved to a dedicated new data-attribute. As a result all items
that trigger a module change have to be adjusted as well.

Resolves: #80565
Releases: master, 8.7
Change-Id: I4687e6594eb539acc0d299dc8fc02e6820019911
Reviewed-on: https://review.typo3.org/53010
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Private/Templates/ModuleMenu/Main.html
typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/HelpToolbarItemDropDown.html
typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/UserToolbarItemDropDown.html
typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js

index 86fc578..5eca371 100644 (file)
@@ -19,7 +19,7 @@
                        <ul class="modulemenu-group-container">
                                <f:for each="{mainModule.children}" as="subModule">
                                        <li id="{subModule.name}" class="modulemenu-item t3js-mainmodule" data-modulename="{mainModule.name}" data-navigationcomponentid="{subModule.navigationComponentId}" data-navigationframescript="{subModule.navigationFrameScript}" data-navigationframescriptparameters="{subModule.navigationFrameScriptParameters}">
-                                               <a title="{subModule.description}" href="{subModule.link}" class="modulemenu-item-link">
+                                               <a href="#" data-link="{subModule.link}" class="modulemenu-item-link" title="{subModule.description}">
                                                        <span class="modulemenu-icon modulemenu-item-icon">
                                 <f:format.raw>{subModule.icon}</f:format.raw>
                                                        </span>
index e911628..31e0b87 100644 (file)
@@ -15,7 +15,7 @@
                                {module.icon -> f:format.raw()}
                        </div>
                        <div class="dropdown-table-column dropdown-table-title">
-                               <a href="{module.link}" title="{module.description -> f:format.htmlspecialchars()}">
+                               <a href="#" data-link="{module.link}" title="{module.description -> f:format.htmlspecialchars()}">
                                        {module.title}
                                </a>
                        </div>
index 475be8c..ae026ca 100644 (file)
@@ -15,7 +15,7 @@
                        >
                                <div class="dropdown-table-column dropdown-table-icon">{module.icon -> f:format.raw()}</div>
                                <div class="dropdown-table-column dropdown-table-title">
-                                       <a href="{module.link}" title="{module.description}">
+                                       <a href="#" data-link="{module.link}" title="{module.description}">
                                                {module.title}
                                        </a>
                                </div>
index b4efb16..5b22615 100644 (file)
@@ -159,7 +159,7 @@ require(
                                        navigationComponentId: $subModuleElement.data('navigationcomponentid'),
                                        navigationFrameScript: $subModuleElement.data('navigationframescript'),
                                        navigationFrameScriptParam: $subModuleElement.data('navigationframescriptparameters'),
-                                       link: $subModuleElement.find('a').attr('href')
+                                       link: $subModuleElement.find('a').data('link')
                                };
                        },