@@ -210,16 +210,24 @@ protected function _renderItemCssClass($menuItem, $level)
210
210
*/
211
211
protected function _renderAnchor ($ menuItem , $ level )
212
212
{
213
- return '<a href=" ' . $ menuItem ->getUrl () . '" ' . $ this ->_renderItemAnchorTitle (
214
- $ menuItem
215
- ) . $ this ->_renderItemOnclickFunction (
216
- $ menuItem
217
- ) . ' class=" ' . $ this ->_renderAnchorCssClass (
218
- $ menuItem ,
219
- $ level
220
- ) . '"> ' . '<span> ' . $ this ->_getAnchorLabel (
221
- $ menuItem
222
- ) . '</span> ' . '</a> ' ;
213
+ if ($ level == 1 && $ menuItem ->getUrl () == '# ' ) {
214
+ $ output = '<strong class="submenu-group-title" role="presentation"> '
215
+ . '<span> ' . $ this ->_getAnchorLabel ($ menuItem ) . '</span> '
216
+ . '</strong> ' ;
217
+ } else {
218
+ $ output = '<a href=" ' . $ menuItem ->getUrl () . '" ' . $ this ->_renderItemAnchorTitle (
219
+ $ menuItem
220
+ ) . $ this ->_renderItemOnclickFunction (
221
+ $ menuItem
222
+ ) . ' class=" ' . $ this ->_renderAnchorCssClass (
223
+ $ menuItem ,
224
+ $ level
225
+ ) . '"> ' . '<span> ' . $ this ->_getAnchorLabel (
226
+ $ menuItem
227
+ ) . '</span> ' . '</a> ' ;
228
+ }
229
+
230
+ return $ output ;
223
231
}
224
232
225
233
/**
@@ -397,15 +405,16 @@ protected function _columnBrake($items, $limit)
397
405
* @param \Magento\Backend\Model\Menu\Item $menuItem
398
406
* @param int $level
399
407
* @param int $limit
408
+ * @param $id int
400
409
* @return string HTML code
401
410
*/
402
- protected function _addSubMenu ($ menuItem , $ level , $ limit )
411
+ protected function _addSubMenu ($ menuItem , $ level , $ limit, $ id = null )
403
412
{
404
413
$ output = '' ;
405
414
if (!$ menuItem ->hasChildren ()) {
406
415
return $ output ;
407
416
}
408
- $ output .= '<div class="submenu"> ' ;
417
+ $ output .= '<div class="submenu" ' . ( $ level == 0 && isset ( $ id ) ? ' aria-labelledby=" ' . $ id . ' " ' : '' ) . ' > ' ;
409
418
$ colStops = null ;
410
419
if ($ level == 0 && $ limit ) {
411
420
$ colStops = $ this ->_columnBrake ($ menuItem ->getChildren (), $ limit );
@@ -440,18 +449,22 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
440
449
$ output .= '</ul></li><li class="column"><ul> ' ;
441
450
}
442
451
452
+ $ id = uniqid ();
443
453
$ output .= '<li ' . $ this ->getUiId (
444
454
$ menuItem ->getId ()
445
455
) . ' class="item- ' . $ itemClass . ' ' . $ this ->_renderItemCssClass (
446
456
$ menuItem ,
447
457
$ level
448
- ) . '"> ' . $ this ->_renderAnchor (
458
+ ) . ($ level == 0 ? '" id=" ' . $ id . '" aria-haspopup="true ' : '' )
459
+ . '"> '
460
+ . $ this ->_renderAnchor (
449
461
$ menuItem ,
450
462
$ level
451
463
) . $ this ->_addSubMenu (
452
464
$ menuItem ,
453
465
$ level ,
454
- $ limit
466
+ $ limit ,
467
+ $ id
455
468
) . '</li> ' ;
456
469
$ itemPosition ++;
457
470
}
0 commit comments