krescruz / angular-materialize

Angularjs directives for Materialize CSS Framework https://github.com/Dogfalo/materialize
MIT License
397 stars 129 forks source link

Multiple select focus bug #199

Closed wesleyvandevoorde closed 7 years ago

wesleyvandevoorde commented 7 years ago

When you have multiple select dropdowns and go from a focussed dropdown directly to another one, the old dropdown remains active. Only when clicking outside the dropdowns closes them. Fixed by closing all dropdowns each time a dropdown is selected.

webbiesdk commented 7 years ago

I can confirm that this seems to be a bug, but also that your code does not fix the bug.

You claim that your new code runs when a dropdown is selected, that is not the case, it runs when the model changes value, which rarely happens at the same time as the dropdown is opened.

Also, the line $('input.select-dropdown').trigger('close'); closes all currently open material-select's, which seems undesirable.

I made a fix, that actually fixes the issue, using your .trigger('close') to close all other material-selects, when you open a new material-select. Will push that in a minute.

The root cause of all of this seems to be some .stopprogation() calls inside materialize.js, but removing them causes other bugs, so that is not an option.