vsn4ik/bootstrap-checkbox

Enter key should submit form, not toggle

Closed this issue · 2 comments

The default behavior for checkboxes is to have the space key toggle the checkbox, and the enter key to submit the form. I noticed that both the space and enter keys toggle the checkbox, which is not consistent with browser behavior.

Any thoughts on this and whether this behavior should be fixed?

Thanks for issue!

After testing (HTML5 data-api), I will add:

options.toggleKeyCode = /^(13|32)$/

Use in JavaScript:

$(':checkbox').checkboxpicker({
  toggleKeyCodes: [32]
});

or in HTML:

<input type="checkbox" data-toggle-key-codes="[32]">