source/fonts.js
// Key Up/Down handler for CSS custom list box

Key Up/Down handler for CSS custom list box
Key Up / Down handler for CSS custom list box
function onListKeydown(e) {
    if (e.target && e.target.nodeName === 'LI') {
      const li = e.target
      let sibling = null
      const keyVal = VBKeys.keyVal(e)
      switch (keyVal) {
        case VBKeys.UP:
          e.preventDefault()
          sibling = li.previousElementSibling
          if (sibling) {
            sibling.focus()
            sibling.click()
          }
          break
        case VBKeys.DOWN:
          e.preventDefault()
          sibling = li.nextElementSibling
          if (sibling) {
            sibling.focus()
            sibling.click()
          }
          break
      }
    }
  }
function onListKeydown ( e ) { if ( e . target && e . target . nodeName === 'LI' ) { const li = e . target let sibling = null const keyVal = VBKeys . keyVal ( e ) switch ( keyVal ) { case VBKeys . UP : e . preventDefault ( ) sibling = li . previousElementSibling if ( sibling ) { sibling . focus ( ) sibling . click ( ) } break case VBKeys . DOWN : e . preventDefault ( ) sibling = li . nextElementSibling if ( sibling ) { sibling . focus ( ) sibling . click ( ) } break } } }
Key Up/Down handler for CSS custom list box
Key Up / Down handler for CSS custom list box
// Only handle keydown events on <li> elements
 // Get the key value (only handle Up and Down)
 // Click on the previous <li>'s <input> descendant
 // Generate a click event on the previous <li> element
 // Click on the next <li>'s <input> descendant
 // Generate a click event on the next <li> element
