var chocolate_store_keyboard_navigation_loop = function (elem) {
  var chocolate_store_tabbable = elem.find('select, input, textarea, button, a').filter(':visible');
  var chocolate_store_firstTabbable = chocolate_store_tabbable.first();
  var chocolate_store_lastTabbable = chocolate_store_tabbable.last();
  chocolate_store_firstTabbable.focus();

  chocolate_store_lastTabbable.on('keydown', function (e) {
    if ((e.which === 9 && !e.shiftKey)) {
      e.preventDefault();
      chocolate_store_firstTabbable.focus();
    }
  });

  chocolate_store_firstTabbable.on('keydown', function (e) {
    if ((e.which === 9 && e.shiftKey)) {
      e.preventDefault();
      chocolate_store_lastTabbable.focus();
    }
  });

  elem.on('keyup', function (e) {
    if (e.keyCode === 27) {
      elem.hide();
    };
  });
};