moneyadviceservice/frontend

MAS Collapsible module - Spacebar opens and immediately closes menu

Closed this issue · 0 comments

@andrewtennison
In mas_collapsible.js, there's a keypress event for the spacebar which triggers a 'click' event on the trigger element. This causes the menu to open and then close immediately.

Commenting out this block fixes this issue...

// Accessibility support for spacebar
this.sections[i].trigger.on('keypress', function(e){
  if(e.which === 32) {
    _this.sections[i].trigger.trigger('click');
  }
});

I've tested it in IE9/10/11, Safari, Firefox and Chrome and both spacebar and enter keypresses toggle the menu as expected.

Happy to do a pull request, just wanted to check the reasoning behind it in case I've missed something.