Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

The offcanvas menu automatically closes when the input is clicked in mobile #57

Open
GevorGSM opened this issue Sep 8, 2016 · 6 comments

Comments

@GevorGSM
Copy link

GevorGSM commented Sep 8, 2016

The offcanvas menu automatically closes when the input is clicked in mobile.when I click in input(in mobile),it trigger window resize and it close the menu .can you add option in tag (like data-recalc='true') and closing menu in resize when option recalc is true or false. thank you

@Davidthecoolsmartguy
Copy link

I have the same issue too.

@sjoonk
Copy link

sjoonk commented Sep 25, 2016

I have too. It seems a resize event occurred when you clicked input on mobile device because of virtual keyboard. When resize event occurred, the opened menu closed automatically by purpose. If you do not want this, you can comment resize event handler in source code, i think.

@robertnurijanyan
Copy link

The resize event seems to be triggered on Android (not on iOS). A temporary fix would be to add an extra check in the resize handler.

 $(window).on('resize', function() {
    if($(document.activeElement).attr('type') !== 'text') {
        $('.navbar-offcanvas.in').each(function() {
             return $(this).height('').removeClass('in');
        });
        return $('.offcanvas-toggle').removeClass('is-open');
    }
});

@pioz
Copy link

pioz commented Feb 8, 2017

I've same issue... my workaround is

    $('#navbar a').on('click', (e) => {
      $('.navbar-offcanvas.in').height('').removeClass('in')
      $('.offcanvas-toggle').removeClass('is-open')
    })

@smokie
Copy link

smokie commented Jul 17, 2017

$(window).on('resize', function (ev) { ev.preventBubble(); });
worked for me, you might want to customize that so it doesn't prevent bubbling on all resize events.

@kriskornel
Copy link

Thanks @smokie it worked for me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants