#32 Navigation Item expanded when a parent item with no link is clicked
Opened 5 years ago by kaylee20. Modified 5 years ago
fedora-docs/ kaylee20/fedora-docs-ui feature-added  into  master

@@ -84,8 +84,6 @@ 

        url: '#liber-recusabo'

        urlType: fragment

      - content: Reference

-       url: '#'

-       urlType: fragment

        items:

        - content: Keyboard Shortcuts

          url: '#'

file modified
+19 -1
@@ -28,8 +28,16 @@ 

        menuState.expandedItems = getExpandedItems()

        saveNavState()

      })

+  	var navItemSpan = findNextElement(btn, '.nav-text')            

+ 	if (navItemSpan) {            

+ 	navItemSpan.style.cursor = 'pointer'            

+ 	navItemSpan.addEventListener('click', function () {            

+     li.classList.toggle('is-active')            

+     menuState.expandedItems = getExpandedItems()            

+     saveNavState()            

+     })            

+     }

    })

- 

    find('.nav-item', menuPanel).forEach(function (item, idx) {

      item.setAttribute('data-id', 'menu-' + item.dataset.depth + '-' + idx)

    })
@@ -143,4 +151,14 @@ 

    function find (selector, from) {

      return [].slice.call((from || document).querySelectorAll(selector))

    }

+   function findNextElement (from, selector) {            

+   var el            

+   if ('nextElementSibling' in from) {            

+   el = from.nextElementSibling            

+   } else {            

+   el = from            

+   while ((el = el.nextSibling) && el.nodeType !== 1);            

+   }            

+   return el && selector ? el[el.matches ? 'matches' : 'msMatchesSelector'](selector) && el : el            

+   }

  })()

This pull request made the changes;
- If an item in the navigation tree is not a link, but it has child items, that item should be expanded when clicked

Signed off by Oyelakin Mercy oyelakinmercy68@gmail.com

1 new commit added

  • The page role may be used for toggling certain items in the layout or to activate additional styles.
5 years ago

1 new commit added

  • Revert "The page role may be used for toggling certain items in the layout or to activate additional styles."
5 years ago

2 new commits added

  • Update src/js/01-navigation.js
  • Update preview-site-src/ui-model.yml
5 years ago