Changes for page Menu Macro
Last modified by teamwire005 on 2025/05/06 07:37
From version 6.1
edited by teamwire004
on 2024/07/12 12:45
on 2024/07/12 12:45
Change comment:
Migrated property [type] from class [XWiki.WikiMacroParameterClass]
To version 9.1
edited by teamwire005
on 2024/10/01 09:14
on 2024/10/01 09:14
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-menu-ui/15.10.12]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (2 modified, 1 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.teamwire00 41 +XWiki.teamwire005
- XWiki.StyleSheetExtension[1]
-
- Code
-
... ... @@ -133,13 +133,15 @@ 133 133 margin-top: 0; 134 134 border-top-right-radius: 0; 135 135 border-top-left-radius: 0; 136 + overflow-wrap: break-word; 137 + hyphens: auto; 136 136 li { 137 137 /* Text inside menu */ 138 138 color: @dropdown-link-color; 141 + padding: 3px 20px; 139 139 /* Links inside menu */ 140 140 a { 141 141 display: block; 142 - padding: 3px 20px; 143 143 clear: both; 144 144 font-weight: normal; 145 145 line-height: @line-height-base;
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,6 +1,7 @@ 1 1 {{velocity}} 2 2 #set ($id = $xcontext.macro.params.id) 3 3 #set ($type = $xcontext.macro.params.type) 4 +#set ($label = $xcontext.macro.params.label) 4 4 #set ($colorTheme = $xwiki.getUserPreference('colorTheme')) 5 5 #if ("$!colorTheme" != '') 6 6 ## Make sure we use an absolute reference (see XWIKI-9672) ... ... @@ -8,16 +8,24 @@ 8 8 #end 9 9 #set ($discard = $xwiki.ssx.use("$xcontext.macro.doc.prefixedFullName", {'colorTheme': $colorTheme})) 10 10 #set ($discard = $xwiki.jsx.use("$xcontext.macro.doc.prefixedFullName")) 12 +## Make sure the label is non-empty as otherwise the aria-label doesn't work. 13 +#if ("$!label" != '') 14 + #set ($label = $wikimacro.context.getXDOM().getIdGenerator().generateUniqueId('Menu','')) 15 +#end 11 11 #if($type.contains('horizontal')) 12 12 ## Make sure the id is non-empty for horizontal menus as otherwise the toggle doesn't work. 13 - #if ( $stringtool.isBlank("$!id"))18 + #if ("$!id" == '') 14 14 #set ($id = $wikimacro.context.getXDOM().getIdGenerator().generateUniqueId("M", "GeneratedMenuId")) 15 15 #end 16 - (% role="navigation" class="menu-horizontal-toggle" %)((( 21 + (% role='navigation' class='menu-horizontal-toggle' 22 + aria-label="${services.rendering.escape($label, 'xwiki/2.1')}" %)((( 17 17 (% class="navbar-header" %)((( 18 18 {{html}} 19 - <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{escapetool.xml($id)}" aria-expanded="false"> 20 - <span class="sr-only"></span> 25 + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{escapetool.xml($id)}" 26 + aria-expanded="false" aria-controls="$!{escapetool.xml($id)}"> 27 + <span class="sr-only"> 28 + $escapetool.xml($services.localization.render('menu.ui.horizontal.toggler.description')) 29 + </span> 21 21 <span class="icon-bar"></span> 22 22 <span class="icon-bar"></span> 23 23 <span class="icon-bar"></span> ... ... @@ -24,12 +24,13 @@ 24 24 </button> 25 25 {{/html}} 26 26 ))) 27 - (% id="$!{services.rendering.escape($id, 'xwiki/2.1')}" class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')} collapse navbar-collapse" %)((( 36 + (% id="$!{services.rendering.escape($id, 'xwiki/2.1')}" class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')} collapse navbar-collapse" role="navigation" %)((( 28 28 {{wikimacrocontent/}} 29 29 ))) 30 30 ))) 31 31 #else 32 - (% #if ("$!id" != '') id="${services.rendering.escape($id, 'xwiki/2.1')}"#end class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}" %)((( 41 + (% role="navigation" #if ("$!id" != '') id="${services.rendering.escape($id, 'xwiki/2.1')}"#end class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}" 42 + aria-label="${services.rendering.escape($label, 'xwiki/2.1')}" %)((( 33 33 {{wikimacrocontent/}} 34 34 ))) 35 35 #end
- XWiki.WikiMacroParameterClass[3]
-
- Parameter description
-
... ... @@ -1,0 +1,1 @@ 1 +Optional menu label used to describe the content of the menu. - Parameter mandatory
-
... ... @@ -1,0 +1,1 @@ 1 +No - Parameter name
-
... ... @@ -1,0 +1,1 @@ 1 +label