ColorlibHQ / AdminLTE

AdminLTE - Free admin dashboard template based on Bootstrap 5
https://adminlte.io
MIT License
43.93k stars 18.18k forks source link

Select2 is not working on touch devices #802

Closed lets-colab closed 8 years ago

lets-colab commented 8 years ago

I am using v2.3.0 of AdminLTE. In this the Select2 (v4.0) dropdowns are not opening on mobile devices. I tested on Chrome developer tools as well as Safari on iOS 9.

gbaudoin commented 8 years ago

I tested in with 2.3.2 on an iPhone 5C. It works, you have to press a bit longer than for a normal click event.

YasserHassan commented 8 years ago

Check this select2/select2#3064

almasaeed2010 commented 8 years ago

It seems like a select2 issue. It should've been solved in the recent version. Try upgrading the current select2 to the latest release.

lets-colab commented 8 years ago

Its an issue with Select2 and Fastclick. After adding 'needsclick' class to all child span elements of 'select2', its working fine as expected.

$('.select2 span').addClass('needsclick')

lets-colab commented 8 years ago

Found a fix. You can replace fastclick.js with the following https://raw.githubusercontent.com/ftlabs/fastclick/569732a7aa5861d428731b8db022b2d55abe1a5a/lib/fastclick.js

Now Select 2 and Fastclick both works like a champ. Happy coding.

nil135 commented 8 years ago

I had tried a lot on this issue, you had resolved it in fraction of second... smart solution !!! Thanks @sajeelmuhammed

Ian-Benn commented 8 years ago

I am using Select2 V3.5.3 and I notice there is an issue when using the select2 control on mobile devices (iPhone iOs 7 to be exact). When using the search feature, the virtual keyboard keeps popping up after the search results are displayed. (Clicking "Done" after the search results appear does nothing; the virtual keyboard just keeps popping up and obscuring much of the search results, making it difficult to scroll through the results). I searched this forum and found some suggestions that I tried - to no avail. Does anyone know if this issue has been fixed in select2 Version 4? Appreciate any feedback.

sebastienb commented 7 years ago

I will try to update the gem and see if it fixes this problem.

jaingrv24 commented 5 years ago

Try below 2 code scripts as it worked to me after wasting lots of hours.

        var ele = $('#control_name');

        // gaurav jain: quick fix for select2 not closing on mobile devices
        ele.on("select2:close", function () {
            setTimeout(function () {
                $('.select2-container-active').removeClass('select2-container-active');
                $(':focus').blur();
            }, 1);
        });

        // gaurav jain: quick fix for select2 not opening on mobile devices if with textbox
        ele.on('select2:open', function () {
            $('.select2-search__field').prop('focus', false);
        });
Kitamura-Philip commented 3 years ago

Thanks., this was of help