JSFiddle - React, Tailwind, and code Playground

HTML

<nav>
    <ul>
        <li><a href="#">JS</a>

        </li>
        <li><a href="#">PHP</a>

        </li>
        <li><a href="#">Python</a>

        </li>
        <li><a href="#">Node.js</a>

        </li>
    </ul>
</nav>

CSS

* {
    padding: 0;
    margin: 0;
    font-family: verdana;
}
nav {
    background: #444;
    color: #fff;
    max-width: 300px;
}
ul {
    list-style: none;
    padding: 0;
    margin: 0;
    padding: 20px 0;
}
ul li {
    text-align: center;
    padding: 10px;
    font-size: 1.3em;
}
ul li a {
    display: block;
    -webkit-transition: background 0.2s;
    -o-transition: background 0.2s;
    transition: background 0.2s;
    color: #fff;
    text-decoration: none;
}
ul li {
    margin-right: 10px;
}
ul li a:hover, ul li a:focus {
    background: tomato;
}

JavaScript

$(function () {
    $(document).on('keydown', checkey);

    var index = 0,
        $items = $('ul li a');


    function checkey(e) {

        // console.log($items);    

        if (e.which == 38) {
            // key up
            index -= 1;
        };
        if (e.which == 40) {
            //key down
            index += 1;
        }

        console.log(index);

        $items.eq(index).trigger('focus');
    }


});