Making Boostrap Menu Accessble:

Example 2: Trap Escape key

Before beginning, make the browser narrow enough to go to the hamburger menu.

This is the default after trapping Esc key to close the menu.

Pressing the escape key will close the menu when focus is in it. Here's the code to add to a JS sheet or in the the document

$(document).keyup(function(e) {
if (e.keyCode == 27) { // escape key maps to keycode `27`

Problems to overcome