materialize icon indicating copy to clipboard operation
materialize copied to clipboard

Materialize Multiple Select Bug (in mobile)

Open hklsk opened this issue 10 years ago • 6 comments

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

hklsk avatar Aug 11 '16 18:08 hklsk

this is easily reproducible by visiting the multiple select demo from a mobile phone (iphone 5s in my case)

imgntn avatar Dec 06 '16 21:12 imgntn

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'); });

Thanood avatar Dec 06 '16 22:12 Thanood

+1, multiple select does not work on ios safari. but demo works: http://materializecss.com/forms.html : (

b-z avatar Apr 06 '17 07:04 b-z

hey all, this bug has already been fixed in the newest version(2017/3/21).

b-z avatar Apr 06 '17 07:04 b-z

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.

PorgJuice avatar May 30 '17 21:05 PorgJuice

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.

sokolmarek avatar Aug 13 '17 19:08 sokolmarek