nice-select2
nice-select2 copied to clipboard
Hitting "return/enter" key submits the form instead of selecting an option in search.
As above. In other single/multi select fields, hitting enter selects the option. In Nice-Select2, it submits the form. There should be a way to prevent this from happening. For the moment I'm just using my own solution:
NiceSelect.bind(
document.getElementById('property_location'),
{searchable: true, placeholder: 'Search'}
);
const searchForm = document.getElementById('property-search-form');
searchForm.addEventListener('submit', function(e) {
if ( searchForm.querySelector('.nice-select-search:focus') ) {
e.preventDefault();
document.getElementById("PrimarySubmit").focus();
}
});
Which works fine, but I feel like this should be the default...