Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The underlying reason for this is that the focus remains on the menu link even though the viewport scrolls to another section.

    What should happen in order is:

    1. Click on page scroll link
    2. Page scrolls to area
    3. Transition happens
    4. Keyboard focus is moved to the top of that area
    Thread Starter jurgenbergman

    (@jurgenbergman)

    Oké, and all that is to be change on java script i presume?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes it should be tied in with the script that animates the plugin so that when the transition has finished (the animation that scrolls down the page) the focus would be moved.

    Plugin Author malihu

    (@malihu)

    You need to add an extra js script in order to do this. The best way is to auto-close the submenu once the links are clicked.

    Try adding the code below in a script tag in your footer.php or in a custom javascript field/placeholder (if your theme provides one):

    (function($){
        $(window).on("load",function(){
            $(".menu-item-has-children").on("click","a._mPS2id-h",function(){
                $(this).blur();
            });
        });
    })(jQuery);

    The code above will simply remove focus from any clicked submenu links (will only apply to links handled by “Page scroll to id”).

    Thread Starter jurgenbergman

    (@jurgenbergman)

    Thank you Milahu!

    That worked beautifully, would never have figured that out myself…

    Jurgen

    Plugin Author malihu

    (@malihu)

    Great! Glad I helped ??
    Marking this as resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sub menu stays open after clicking’ is closed to new replies.