it'll be much cleaner if you replaced line 18 with
`
if ( event.which == 32) {
      dropdownMenuToggle.click();
      event.preventDefault();
}
`