Commit 08cb7b6d authored by Torben Hansen's avatar Torben Hansen Committed by Christian Kuhn
Browse files

[TASK] Removed unknown aria attribute from modules menu

Removed an unknown aria attribute from the modules menu
and added an `aria-controls` attribute to 1st level menu
items.

Resolves: #92634
Releases: master, 10.4
Change-Id: Id15f902053e091add3e1321dbf6e6d23d9a0805d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66261


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Michael Telgkamp's avatarMichael Telgkamp <michael.telgkamp@mindscreen.de>
Tested-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Michael Telgkamp's avatarMichael Telgkamp <michael.telgkamp@mindscreen.de>
Reviewed-by: default avatarMartin Kutschker <mkutschker-typo3@yahoo.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 0371f346
......@@ -243,7 +243,6 @@ class ModuleMenu {
moduleGroup.classList.toggle('.modulemenu-group-collapsed', ariaExpanded);
moduleGroup.classList.toggle('.modulemenu-group-expanded', !ariaExpanded);
moduleGroupContainer.attributes.getNamedItem('aria-visible').value = (!ariaExpanded).toString();
target.attributes.getNamedItem('aria-expanded').value = (!ariaExpanded).toString();
$(moduleGroupContainer).stop().slideToggle({
......
......@@ -10,7 +10,7 @@
<f:if condition="{modules} && {currentLevel} <= 2">
<ul
class="modulemenu-group-container"
{f:if(condition: '{parent}', then: 'aria-visible="{f:if(condition: parent.collapsed, then: \'false\', else: \'true\')}"')}
{f:if(condition: '{parent} && {currentLevel} == 2', then: 'id="submenu-{parent.name}"')}
{f:if(condition: '{parent}', then: '{f:if(condition: parent.collapsed, then: \'style="display: none"\')}')}
>
<f:for each="{modules}" as="module">
......@@ -28,7 +28,7 @@
{f:if(condition: module.navigationComponentId, then: 'data-navigationcomponentid="{module.navigationComponentId}"')}
{f:if(condition: module.navigationFrameScript, then: 'data-navigationframescript="{module.navigationFrameScript}"')}
{f:if(condition: module.navigationFrameScriptParameters, then: 'data-navigationframescriptparameters="{module.navigationFrameScriptParameters}"')}
{f:if(condition: '{module.children} && {currentLevel} == 1', then: 'aria-haspopup="true" aria-expanded="{f:if(condition: module.collapsed, then: \'false\', else: \'true\')}"')}
{f:if(condition: '{module.children} && {currentLevel} == 1', then: 'aria-haspopup="true" aria-expanded="{f:if(condition: module.collapsed, then: \'false\', else: \'true\')}" aria-controls="submenu-{module.name}"')}
>
<span class="modulemenu-icon" aria-hidden="true"><f:format.raw>{module.icon}</f:format.raw></span>
<span class="modulemenu-name">{module.title}</span>
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,o,a,i,l,d,r,u){"use strict";o=__importDefault(o);class s{constructor(){this.loadedModule=null,this.loadedNavigationComponentId="",o.default(()=>this.initialize())}static getCollapsedMainMenuItems(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=s.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],a.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId&&!e.navigationFrameScript)return t;let n="";return n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0],top.fsMod.recentIds[n]&&(t="id="+top.fsMod.recentIds[n]+"&"+t),t}static toggleMenu(e){i.NavigationContainer.cleanup();const t=o.default(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||o.default(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e}),i.doLayout()}static getRecordFromName(e){const t=o.default("#"+e);return{name:e,navigationComponentId:t.data("navigationcomponentid"),navigationFrameScript:t.data("navigationframescript"),navigationFrameScriptParam:t.data("navigationframescriptparameters"),link:t.data("link")}}static highlightModuleMenuItem(e){o.default(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active"),o.default("#"+e).addClass("modulemenu-action-active")}refreshMenu(){new r(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,top.currentModuleLoaded&&s.highlightModuleMenuItem(top.currentModuleLoaded),i.doLayout()})}reloadFrames(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const o=s.getRecordFromName(e);return this.loadModuleComponents(o,t,new l("typo3.showModule",n))}initialize(){const e=this;let t=o.default.Deferred();if(t.resolve(),top.startInModule&&top.startInModule[0]&&o.default("#"+top.startInModule[0]).length>0)t=this.showModule(top.startInModule[0],top.startInModule[1]);else{const e=o.default(".t3js-modulemenu-action[data-link]:first");e.attr("id")&&(t=this.showModule(e.attr("id")))}t.then(()=>{e.initializeEvents()})}initializeEvents(){new u("click",(e,t)=>{const n=t.closest(".modulemenu-group"),a=n.querySelector(".modulemenu-group-container"),l="true"===t.attributes.getNamedItem("aria-expanded").value;l?s.addCollapsedMainMenuItem(t.id):s.removeCollapseMainMenuItem(t.id),n.classList.toggle(".modulemenu-group-collapsed",l),n.classList.toggle(".modulemenu-group-expanded",!l),a.attributes.getNamedItem("aria-visible").value=(!l).toString(),t.attributes.getNamedItem("aria-expanded").value=(!l).toString(),o.default(a).stop().slideToggle({complete:function(){i.doLayout()}})}).delegateTo(document.querySelector(".t3js-modulemenu"),".t3js-modulemenu-collapsible"),new u("click",(e,t)=>{void 0!==t.dataset.link&&(e.preventDefault(),this.showModule(t.id,"",e))}).delegateTo(document,".t3js-modulemenu-action"),new u("click",e=>{e.preventDefault(),s.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new u("click",e=>{e.preventDefault(),s.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay")),new u("click",e=>{e.preventDefault(),i.NavigationContainer.toggle()}).bindTo(document.querySelector(".t3js-topbar-button-navigationcomponent"))}loadModuleComponents(e,t,n){const a=e.name,l=i.ContentContainer.beforeSetUrl(n);return l.then(o.default.proxy(()=>{e.navigationComponentId?this.loadNavigationComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),this.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new d("typo3.loadModuleComponents",n))):i.NavigationContainer.hide(),s.highlightModuleMenuItem(a),this.loadedModule=a,t=s.includeId(e,t),this.openInContentFrame(e.link,t,new d("typo3.loadModuleComponents",n)),top.currentSubScript=e.link,top.currentModuleLoaded=a,i.doLayout()},this)),l}loadNavigationComponent(t){const n=this;if(i.NavigationContainer.show(t),t===this.loadedNavigationComponentId)return;const a=t.replace(/[/]/g,"_");""!==this.loadedNavigationComponentId&&o.default("#navigationComponent-"+this.loadedNavigationComponentId.replace(/[/]/g,"_")).hide(),o.default('.t3js-scaffold-content-navigation [data-component="'+t+'"]').length<1&&o.default(".t3js-scaffold-content-navigation").append(o.default("<div />",{class:"scaffold-content-navigation-component","data-component":t,id:"navigationComponent-"+a})),e([t],e=>{e.initialize("#navigationComponent-"+a),i.NavigationContainer.show(t),n.loadedNavigationComponentId=t})}openInNavFrame(e,t,n){const o=e+(t?(e.includes("?")?"&":"?")+t:""),a=i.NavigationContainer.getUrl(),l=i.NavigationContainer.setUrl(e,new d("typo3.openInNavFrame",n));return a!==o&&("resolved"===l.state()?i.NavigationContainer.refresh():l.then(i.NavigationContainer.refresh)),l}openInContentFrame(e,t,n){let o;if(top.nextLoadModuleUrl)o=i.ContentContainer.setUrl(top.nextLoadModuleUrl,new d("typo3.openInContentFrame",n)),top.nextLoadModuleUrl="";else{const a=e+(t?(e.includes("?")?"&":"?")+t:"");o=i.ContentContainer.setUrl(a,new d("typo3.openInContentFrame",n))}return o}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new s});return top.TYPO3.ModuleMenu}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,o,a,i,l,d,r,u){"use strict";o=__importDefault(o);class s{constructor(){this.loadedModule=null,this.loadedNavigationComponentId="",o.default(()=>this.initialize())}static getCollapsedMainMenuItems(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=s.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],a.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId&&!e.navigationFrameScript)return t;let n="";return n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0],top.fsMod.recentIds[n]&&(t="id="+top.fsMod.recentIds[n]+"&"+t),t}static toggleMenu(e){i.NavigationContainer.cleanup();const t=o.default(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||o.default(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e}),i.doLayout()}static getRecordFromName(e){const t=o.default("#"+e);return{name:e,navigationComponentId:t.data("navigationcomponentid"),navigationFrameScript:t.data("navigationframescript"),navigationFrameScriptParam:t.data("navigationframescriptparameters"),link:t.data("link")}}static highlightModuleMenuItem(e){o.default(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active"),o.default("#"+e).addClass("modulemenu-action-active")}refreshMenu(){new r(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,top.currentModuleLoaded&&s.highlightModuleMenuItem(top.currentModuleLoaded),i.doLayout()})}reloadFrames(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const o=s.getRecordFromName(e);return this.loadModuleComponents(o,t,new l("typo3.showModule",n))}initialize(){const e=this;let t=o.default.Deferred();if(t.resolve(),top.startInModule&&top.startInModule[0]&&o.default("#"+top.startInModule[0]).length>0)t=this.showModule(top.startInModule[0],top.startInModule[1]);else{const e=o.default(".t3js-modulemenu-action[data-link]:first");e.attr("id")&&(t=this.showModule(e.attr("id")))}t.then(()=>{e.initializeEvents()})}initializeEvents(){new u("click",(e,t)=>{const n=t.closest(".modulemenu-group"),a=n.querySelector(".modulemenu-group-container"),l="true"===t.attributes.getNamedItem("aria-expanded").value;l?s.addCollapsedMainMenuItem(t.id):s.removeCollapseMainMenuItem(t.id),n.classList.toggle(".modulemenu-group-collapsed",l),n.classList.toggle(".modulemenu-group-expanded",!l),t.attributes.getNamedItem("aria-expanded").value=(!l).toString(),o.default(a).stop().slideToggle({complete:function(){i.doLayout()}})}).delegateTo(document.querySelector(".t3js-modulemenu"),".t3js-modulemenu-collapsible"),new u("click",(e,t)=>{void 0!==t.dataset.link&&(e.preventDefault(),this.showModule(t.id,"",e))}).delegateTo(document,".t3js-modulemenu-action"),new u("click",e=>{e.preventDefault(),s.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new u("click",e=>{e.preventDefault(),s.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay")),new u("click",e=>{e.preventDefault(),i.NavigationContainer.toggle()}).bindTo(document.querySelector(".t3js-topbar-button-navigationcomponent"))}loadModuleComponents(e,t,n){const a=e.name,l=i.ContentContainer.beforeSetUrl(n);return l.then(o.default.proxy(()=>{e.navigationComponentId?this.loadNavigationComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),this.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new d("typo3.loadModuleComponents",n))):i.NavigationContainer.hide(),s.highlightModuleMenuItem(a),this.loadedModule=a,t=s.includeId(e,t),this.openInContentFrame(e.link,t,new d("typo3.loadModuleComponents",n)),top.currentSubScript=e.link,top.currentModuleLoaded=a,i.doLayout()},this)),l}loadNavigationComponent(t){const n=this;if(i.NavigationContainer.show(t),t===this.loadedNavigationComponentId)return;const a=t.replace(/[/]/g,"_");""!==this.loadedNavigationComponentId&&o.default("#navigationComponent-"+this.loadedNavigationComponentId.replace(/[/]/g,"_")).hide(),o.default('.t3js-scaffold-content-navigation [data-component="'+t+'"]').length<1&&o.default(".t3js-scaffold-content-navigation").append(o.default("<div />",{class:"scaffold-content-navigation-component","data-component":t,id:"navigationComponent-"+a})),e([t],e=>{e.initialize("#navigationComponent-"+a),i.NavigationContainer.show(t),n.loadedNavigationComponentId=t})}openInNavFrame(e,t,n){const o=e+(t?(e.includes("?")?"&":"?")+t:""),a=i.NavigationContainer.getUrl(),l=i.NavigationContainer.setUrl(e,new d("typo3.openInNavFrame",n));return a!==o&&("resolved"===l.state()?i.NavigationContainer.refresh():l.then(i.NavigationContainer.refresh)),l}openInContentFrame(e,t,n){let o;if(top.nextLoadModuleUrl)o=i.ContentContainer.setUrl(top.nextLoadModuleUrl,new d("typo3.openInContentFrame",n)),top.nextLoadModuleUrl="";else{const a=e+(t?(e.includes("?")?"&":"?")+t:"");o=i.ContentContainer.setUrl(a,new d("typo3.openInContentFrame",n))}return o}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new s});return top.TYPO3.ModuleMenu}));
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment