Materialize Multiple Select Bug (in mobile)
When user open the select box, the readonly input will become focus. Although the select drop down normally, user cannot dismiss the multiple select box tapping outside the select box.
Tested in safari iOS 9.3.3 and Chrome iOS
this is easily reproducible by visiting the multiple select demo from a mobile phone (iphone 5s in my case)
When I understand this correctly, this may be a workaround: https://github.com/Dogfalo/materialize/issues/3790
Also, redirect touchstart events to trigger a click on iOS. That is something like:
$(document).on('touchstart', function(e) { $(document).trigger('click'); });
+1, multiple select does not work on ios safari. but demo works: http://materializecss.com/forms.html : (
hey all, this bug has already been fixed in the newest version(2017/3/21).
I have this problem on Materialize 0.98.2. It's present on a project I'm working on, but I get the same thing when visiting the demo page on my iPhone.
Hey guys this code should fix the problem with multiple select and closing it on iOS devices.
$(document).on('touchstart', function (e) {
let target = $(e.target);
if (!target.is("span")) { //checking if you are tapping on items in multiple select or not
$(document).trigger('click'); //if you are tapping outside multiple select close it
$(':focus').blur(); //focus out for multiple select so you can choose another or the same (in case you have more multiple selects on page)
} else {
//nothing or fire another event
};
});
This works for me.