Giter Site home page Giter Site logo

adobe-accessibility / accessible-mega-menu Goto Github PK

View Code? Open in Web Editor NEW
603.0 52.0 198.0 245 KB

A demonstration of how to implement a keyboard and screen reader accessible mega menu as a jQuery plugin.

License: Apache License 2.0

CSS 26.35% JavaScript 1.80% HTML 71.85%

accessible-mega-menu's Introduction

Accessible Mega Menu (Not actively maintained)

=========================

A demonstration of how to implement a keyboard and screen reader accessible mega menu as a jQuery plugin. It is modeled after the mega menu on adobe.com but has been simplified for use by others. An brief explanation of our interaction design choices can be found in a blog post at Mega menu accessibility on adobe.com.

Content for the links and text within the mega menu comes from the Web Content Accessibility Guidelines (WCAG) 2.0.

Keyboard Accessibility

The accessible mega menu supports keyboard interaction modeled after the behavior described in the WAI-ARIA Menu or Menu bar (widget) design pattern, however we also try to respect users' general expectations for the behavior of links in a global navigation. To this end, the accessible mega menu implementation permits tab focus on each of the six top-level menu items. When one of the menu items has focus, pressing the Enter key, Spacebar or Down arrow will open the submenu panel, and pressing the Left or Right arrow key will shift focus to the adjacent menu item. Links within the submenu panels are included in the tab order when the panel is open. They can also be navigated with the arrow keys or by typing the first character in the link name, which speeds up keyboard navigation considerably. Pressing the Escape key closes the submenu and restores focus to the parent menu item.

Screen Reader Accessibility

The accessible mega menu models its use of WAI-ARIA Roles, States, and Properties after those described in the WAI-ARIA Menu or Menu bar (widget) design pattern with some notable exceptions, so that it behaves better with screen reader user expectations for global navigation. We don't use role="menu" for the menu container and role="menuitem" for each of the links therein, because if we do, assistive technology will no longer interpret the links as links, but instead, as menu items, and the links in our global navigation will no longer show up when a screen reader user executes a shortcut command to bring up a list of links in the page.

We also want to maintain the semantic structure of the submenu panels in our mega menu; our links are organized into lists and separated by headings. Omitting role="menu" and role="menuitem" for the global navigation seems the safer way to go.

Usage

HTML

The HTML structure for the mega menu is a nav element, or any other container element, containing a list. Each list item contains a link which is followed by a div or any other container element which will serve as the pop up panel. The panel can contain any html content; in the following example, each panel contains three lists of links. You can explicitly define groups within the panel, between which a user can navigate quickly using the left and right arrow keys; in the following example, the CSS class .sub-nav-group identifies a navigable group.

    <nav>
        <ul class="nav-menu">
            <li class="nav-item">
                <a href="?movie">Movies</a>
                <div class="sub-nav">
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=0">Action &amp; Adventure</a></li>
                        <li><a href="?movie&genre=2">Children &amp; Family</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=7">Dramas</a></li>
                        <li><a href="?movie&genre=9">Foreign</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=14">Musicals</a></li>
                        <li><a href="?movie&genre=15">Romance</a></li>
                        <li>&#8230;</li>
                    </ul>
                </div>
            </li>
            <li class="nav-item">
                <a href="?tv">TV Shows</a>
                <div class="sub-nav">
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=20">Classic TV</a></li>
                        <li><a href="?tv&genre=21">Crime TV</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=27">Reality TV</a></li>
                        <li><a href="?tv&genre=30">TV Action</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=33">TV Dramas</a></li>
                        <li><a href="?tv&genre=34">TV Horror</a></li>
                        <li>&#8230;</li>
                    </ul>
                </div>
            </li>
        </ul>
    </nav>

By default, accessibleMegaMenu uses the the following CSS classes to define the top-level navigation items, panels, groups within the panels, and the hover, focus, and open states. It also defines a prefix for unique id strings, which are required to indicate the relationship of a top-level navigation item to the panel it controls.

    defaults = {
        /* unique ID's are required to indicate aria-owns, aria-controls and aria-labelledby */
        uuidPrefix: "accessible-megamenu",
        
        /* default css class used to define the megamenu styling */
        menuClass: "accessible-megamenu",
        
        /* default css class for a top-level navigation item in the megamenu */
        topNavItemClass: "accessible-megamenu-top-nav-item",
        
        /* default css class for a megamenu panel */
        panelClass: "accessible-megamenu-panel",
        
        /* default css class for a group of items within a megamenu panel */
        panelGroupClass: "accessible-megamenu-panel-group",
        
        /* default css class for the hover state */
        hoverClass: "hover",
        
        /* default css class for the focus state */
        focusClass: "focus",
        
        /* default css class for the open state */
        openClass: "open" 
    }

You can optionally override the defaults to use the CSS classes you may have already defined for your mega menu.

JavaScript

Be sure to include jQuery and the jquery-accessibleMegaMenu.js plugin script.

    <script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="js/jquery-accessibleMegaMenu.js"></script>

The following initializes the first nav element in the document as an accessibleMegaMenu, with optional CSS class overrides.

    $("nav:first").accessibleMegaMenu({
        /* prefix for generated unique id attributes, which are required 
           to indicate aria-owns, aria-controls and aria-labelledby */
        uuidPrefix: "accessible-megamenu",
        
        /* css class used to define the megamenu styling */
        menuClass: "nav-menu",
        
        /* css class for a top-level navigation item in the megamenu */
        topNavItemClass: "nav-item",
        
        /* css class for a megamenu panel */
        panelClass: "sub-nav",
        
        /* css class for a group of items within a megamenu panel */
        panelGroupClass: "sub-nav-group",
        
        /* css class for the hover state */
        hoverClass: "hover",
        
        /* css class for the focus state */
        focusClass: "focus",
        
        /* css class for the open state */
        openClass: "open"
    });

CSS

AccessibleMegaMenu handles the showing and hiding of panels by adding or removing a CSS class. No inline styles are added to hide elements or create animation between states.

Following is some rudimentary CSS for our example which enables the showing/hiding of and the layout of lists panels in the mega menu.

    /* mega menu list */
    .nav-menu {
        display: block;
        position: relative;
        list-style: none;
        margin: 0;
        padding: 0;
        z-index: 15;
    }

    /* a top level navigation item in the mega menu */
    .nav-item {
        list-style: none;
        display: inline-block;
        padding: 0;
        margin: 0;
    }

    /* first descendant link within a top level navigation item */
    .nav-item > a {
        position: relative;
        display: inline-block;
        padding: 0.5em 1em;
        margin: 0 0 -1px 0;
        border: 1px solid transparent;
    }

    /* focus/open states of first descendant link within a top level 
       navigation item */
    .nav-item > a:focus,
    .nav-item > a.open {
        border: 1px solid #dedede;
    }

    /* open state of first descendant link within a top level 
       navigation item */
    .nav-item > a.open {
        background-color: #fff;
        border-bottom: none;
        z-index: 1;
    }

    /* sub-navigation panel */
    .sub-nav {
        position: absolute;
        display: none;
        top: 2.2em;
        margin-top: -1px;
        padding: 0.5em 1em;
        border: 1px solid #dedede;
        background-color: #fff;
    }

    /* sub-navigation panel open state */
    .sub-nav.open {
        display: block;
    }

    /* list of items within sub-navigation panel */
    .sub-nav ul {
        display: inline-block;
        vertical-align: top;
        margin: 0 1em 0 0;
        padding: 0;
    }

    /* list item within sub-navigation panel */
    .sub-nav li {
        display: block;
        list-style-type: none;
        margin: 0;
        padding: 0;
    }   

Putting it all together, here is the completed example:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Simple Accessible Mega Menu Example</title>
    <style>
        /* Rudimentary mega menu CSS for demonstration */    

        /* mega menu list */
        .nav-menu {
            display: block;
            position: relative;
            list-style: none;
            margin: 0;
            padding: 0;
            z-index: 15;
        }

        /* a top level navigation item in the mega menu */
        .nav-item {
            list-style: none;
            display: inline-block;
            padding: 0;
            margin: 0;
        }

        /* first descendant link within a top level navigation item */
        .nav-item > a {
            position: relative;
            display: inline-block;
            padding: 0.5em 1em;
            margin: 0 0 -1px 0;
            border: 1px solid transparent;
        }

        /* focus/open states of first descendant link within a top level 
           navigation item */
        .nav-item > a:focus,
        .nav-item > a.open {
            border: 1px solid #dedede;
        }

        /* open state of first descendant link within a top level 
           navigation item */
        .nav-item > a.open {
            background-color: #fff;
            border-bottom: none;
            z-index: 1;
        }

        /* sub-navigation panel */
        .sub-nav {
            position: absolute;
            display: none;
            top: 2.2em;
            margin-top: -1px;
            padding: 0.5em 1em;
            border: 1px solid #dedede;
            background-color: #fff;
        }

        /* sub-navigation panel open state */
        .sub-nav.open {
            display: block;
        }

        /* list of items within sub-navigation panel */
        .sub-nav ul {
            display: inline-block;
            vertical-align: top;
            margin: 0 1em 0 0;
            padding: 0;
        }

        /* list item within sub-navigation panel */
        .sub-nav li {
            display: block;
            list-style-type: none;
            margin: 0;
            padding: 0;
        }     
    </style>
    </head>
    <body>
    <nav>
        <ul class="nav-menu">
            <li class="nav-item">
                <a href="?movie">Movies</a>
                <div class="sub-nav">
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=0">Action &amp; Adventure</a></li>
                        <li><a href="?movie&genre=2">Children &amp; Family</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=7">Dramas</a></li>
                        <li><a href="?movie&genre=9">Foreign</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?movie&genre=14">Musicals</a></li>
                        <li><a href="?movie&genre=15">Romance</a></li>
                        <li>&#8230;</li>
                    </ul>
                </div>
            </li>
            <li class="nav-item">
                <a href="?tv">TV Shows</a>
                <div class="sub-nav">
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=20">Classic TV</a></li>
                        <li><a href="?tv&genre=21">Crime TV</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=27">Reality TV</a></li>
                        <li><a href="?tv&genre=30">TV Action</a></li>
                        <li>&#8230;</li>
                    </ul>
                    <ul class="sub-nav-group">
                        <li><a href="?tv&genre=33">TV Dramas</a></li>
                        <li><a href="?tv&genre=34">TV Horror</a></li>
                        <li>&#8230;</li>
                    </ul>
                </div>
            </li>
        </ul>
    </nav>
    
    <!-- include jquery -->
    <script src="//code.jquery.com/jquery-1.10.1.min.js"></script>

    <!-- include the jquery-accessibleMegaMenu plugin script -->
    <script src="js/jquery-accessibleMegaMenu.js"></script>

    <!-- initialize a selector as an accessibleMegaMenu -->
    <script>
        $("nav:first").accessibleMegaMenu({
            /* prefix for generated unique id attributes, which are required 
               to indicate aria-owns, aria-controls and aria-labelledby */
            uuidPrefix: "accessible-megamenu",
            
            /* css class used to define the megamenu styling */
            menuClass: "nav-menu",
            
            /* css class for a top-level navigation item in the megamenu */
            topNavItemClass: "nav-item",
            
            /* css class for a megamenu panel */
            panelClass: "sub-nav",
            
            /* css class for a group of items within a megamenu panel */
            panelGroupClass: "sub-nav-group",
            
            /* css class for the hover state */
            hoverClass: "hover",
            
            /* css class for the focus state */
            focusClass: "focus",
            
            /* css class for the open state */
            openClass: "open"
        });
    </script>
    </body>
    </html>

accessible-mega-menu's People

Contributors

accdc avatar awkawk avatar lloydi avatar maedi avatar majornista avatar tdhooper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accessible-mega-menu's Issues

Click Main Option to Open

Is there a way I can make it so you have to click or press enter/space to get the first level of the menu to open? I don't want it to happen on hover of the mouse. Most menu scripts I have seen have some parameters that can be set through JavaScript but I can't find any API with this one that does this.

Thank you in advance.

Can we implement the Menu beyond 2 levels.

We do have a requirement to show the Menu beyond 2 levels. Mouse over on main Menu should pop the Sub-Menu and mouse over on the sub-Menu should pop the next level menu. Can we achieve this functionality using the "Accessible-Mega-Menu" ?

As in the below image "Submit Software" opens up the Menu with 3 line items

Submit Software 1
Submit Software 2
Submit Software 3

Each one of the above menu items has its own sub-Menu.

samplemenu

Pressing arrow keys to move around menu makes carousel oicture change too.

On Adobe site, pressing arrow keys to move around menu makes carousel picture change too. In Chrome I tabbed into menu, then right and left arrowed... noticed every time I arrow to move focus the picture in the carousel changes under the menu... seems like the carousel is still listening to the arrow keys... should perhaps should grab exclusive control of arrow keys to disengage carousel when menu is open

Menu flashes when mouse positioned just right on Chromium based browsers

Low severity

Issue: Moving your mouse slowly up from below the menu to the top menu item causes the menu to repeatedly flash. The menu remains usable, but it is a bit annoying.

Test on OS: Windows 10 Pro Version 1803

Found in: Chrome Version 72.0.3626.121 (Official Build) (64-bit), Brave Version 0.60.48 Chromium: 72.0.3626.121 (Official Build) (64-bit)

Tested and not found in: Microsoft Edge 42.17134.1.0 & Firefox 65.0.2 (64-bit)

Working partially on Wordpress and Divi theme

Left-right ARROW navigation actually is working, but ENTER to follow links gets an JS error and ARROW down/ENTER to open submenu does nothing.

Fixing it is above my paygrade but is it even possible or is there any alternative for that script out there? Any better maintained fork etc?
From accessibility point of view this functionality is pretty good, still, even after all these years.

jquery 3 has renamed jQuery.expr[":"]

After testing jquery 3 the migrate plugin idetified the following:

jQuery.expr[":"] is now jQuery.expr.pseudos
@ jquery.accessibleMegaMenu.js:1042

Two mouse clicks required for top level menu in Firefox, IE, Opera

When first loading a page using this menu in Firefox 27, IE 10, or Opera 12.16, it seems to require one mouse click on any top level menu (ie, from the index.html sample: Perceivable | Operable | Understandable | Robust) to focus, then a second click on any other top level menu to load the URL.
Using Chrome 32.0.1700.107 and Safari 5.1.7 it works with only a single click.

Showcase or feature

Hello.

I love this plugin! I think this is the best one yet. I wanted to let you know that I incorporated for sfcollege.edu and among other college's microsites. Keep tabbing on your keyboard until you see the mega menu.

Figured you might want to have this as a showcase? Thank you.

RTL support - reversed navigation keys

The navigation is now working according to the LEFT / RIGHT arrows, but those has different next / previous meaning in different directions (RTL / LTR).

I've sent a PR with the fix, please merge to the master branch :)

Thanks.

Visual indication of presence of sub-menu

Would it be a good idea to include some kind of icon (downwards pointing arrow maybe) in the top-level items? This would help to alert sighted keyboard users that a dropdown menu was present.

Has the project been abandoned?

Just wondering if this project has been abandoned?
I have an explicit need for accessibility on a very large mega menu and this solution fits well.. (albeit with some quirks).
Are there any other solutions?

Page scrolls down to the focused menu item on load

We have a large vertical menu for a book table of contents. When you click a menu link below the fold then the page will load and scroll down to the focused menu item. We want the menu item to have focus, but we do not want the page to scroll down to it on load. It is fine to scroll when you use the arrow keys after the page has loaded, but not until then.

Can't use top level links?

Hi. It seems that top level links without dropdowns won't work.
For example, the following will not work:

<ul class="nav-menu js-nav-menu" id="accessible-megamenu-1578670430615-1">
    <li class="nav-item has-dropdown">
        <a href="#" id="accessible-megamenu-1578670430627-2" role="button" aria-controls="accessible-megamenu-1578670430627-3" aria-expanded="false" tabindex="0" class="">About</a>
        <div class="sub-nav" id="accessible-megamenu-1578670430627-3" role="region" aria-expanded="false" aria-hidden="true" aria-labelledby="accessible-megamenu-1578670430627-2">
            <ul>
                <li><a href="about.php">About Us</a></li>
                <li><a href="services.php">Services</a></li>
            </ul>
        </div>
    </li>
    <li class="nav-item">
        <a href="contacts.php">Contact Lenses</a>
    </li>

Where if I change the second link to:

      <a href="#" id="" role="button" aria-controls="" aria-expanded="false" tabindex="0">Contacts</a>
      <div class="sub-nav" role="region" aria-expanded="false" aria-hidden="true">
        <a href="contacts.php">Contact Lenses</a>
      </div>

It will? How should I handle top level links without sub-navs? For example, social media icons?

jQuery UI selectmenu inside megamenu not working

Hi,

I have a jqueryUi selectmenu inside the megamenu but its not working with keyboard. its opens correctly using CTRL + DOWN key but keyboard UP and DOWN not working to select an item and also ENTER to select

Touch support breaks scrolling

We are having an issue where our nav items stack vertically for a responsive layout.

If you attempt to touch scroll starting on any item, the menu click handler calls preventDefault and the touchMove event never fires for the native browser to scroll the page.

Markup would be more accessible if ARIA attributes are changed

It works, though I'd recommend some changes.
 
Currently the triggering elements are marked up as links, but I'd recommend
role=button, since this would make it easier to quickly jump between each
triggering element using a screen reader, even though the styling would be the
same.
 
Also it uses aria-haspopup, which technically doesn't make much sense, because
it opens an accordion type interface for screen reader users, and not a menu as
implied regardless what the visual styling is.
 
The use of aria-expanded is good to indicate the state.
 
The use of role=group however would be better served using role=region instead,
because then you could use the screen reader region navigation commands to
quickly jump to the open accordion panel by pressing 'r' or 'shift+r', which
you cannot do using role=group.
 
Also, it would be good to set an explicit label for the role=region using
aria-labelledby that points back to the triggering element, so it is clear
which triggering element the region belongs to when jumping to it.
 
Also, regions can be nested, so you can tell what the structure is at the same
time when expanding sub sections if present.
 
Here is an accordion that uses this method for testing to see how it sounds:
http://whatsock.com/tsg/Coding%20Arena/ARIA%20and%20Non-ARIA%20Accordions/ARIA%20Accordion%20(Internal%20Content)/demo.htm 
Though aria-pressed isn't necessary in this case even though the demo uses this
method.

Not working properly With Wordpress Avada Theme

I have updated menu structure as per "http://terrillthompson.com/tests/menus/accessible-mega-menu/test.html"
Javascript code is as follows:

<script src=""></script>
    <script>
    	jQuery(document).ready(function(){
			//console.log( jQuery(".fusion-secondary-main-menu nav.fusion-main-menu:first"));
			
			setTimeout(function(){
				
				jQuery(".fusion-secondary-main-menu nav.fusion-main-menu").accessibleMegaMenu({
			// prefix for generated unique id attributes, which are required 
			//   to indicate aria-owns, aria-controls and aria-labelledby //
			uuidPrefix: "accessible-megamenu",
			
			// css class used to define the megamenu styling 
			menuClass: "fusion-menu",
			
			// css class for a top-level navigation item in the megamenu 
			topNavItemClass: "menu-item-type-custom",
			
			// css class for a megamenu panel 
			panelClass: "sub-nav",
			
			// css class for a group of items within a megamenu panel 
			panelGroupClass: "sub-nav-group",
			
			// css class for the hover state 
			hoverClass: "hover",
			
			// css class for the focus state 
			focusClass: "focus",
			
			// css class for the open state 
			openClass: "open"
		});
				
				},3000);
			   
		});
    </script>

I have tried without passing parameters as well. It will not work at all. After that i have added tabedindex on li element and it starts working partially.

URL : http://accjcorg.staging.wpengine.com/

After adding tabindex issues are as follows:
1 - I need to press down keys two times to move from one sub-menu item to other
2 - Main navigation movement is not working with arrow keys as well

Please guide me abut it.

Possible to have another branch that works with jQuery 1.7?

I'm not sure how easy this would be to do, but is it possible to have a version of this that works with jQuery 1.7? I trying to implement on a large website I can't simply upgrade the jQuery version across the board without some other functionality potentially breaking.

Megamenu does not count with single items in menu

When you have single item menu without any subitems the link itself is getting the "panelClass".
This is making hard to add proper CSS for the submenu.

The solution for this would be to remove line 842 ".addClass(settings.panelClass)" in js/jquery-accessibleMegaMenu.js

Navigation with arrow keys is incorrect with JAWS

When you try to navigate through the sub-menu with the keyboard when the sub-menu has a list of links and you press Up/Down keys JAWS will read the link text but the focus will stay on the last element selected with the tab key and if you press the tab key again the focus will move to the element after the last one JAWS read with the arrow keys.

Using the live example http://adobe-accessibility.github.io/Accessible-Mega-Menu/

  1. Navigate to Operable -> "2.1.1 Keyboard" with the tab key. All will be read normally.
  2. Use Down arrow key and JAWS will read the next element but the focus will remain on "2.1.1 Keyboard"

Thanks,

jquery-accessibleMegaMenu.js in this repo breaks the example

i'm trying to use the example menu at the top of the homepage, as a starting point:
https://adobe-accessibility.github.io/Accessible-Mega-Menu/

homepage (screenshot):

mega menu

homepage but with jquery-accessibleMegaMenu.js from this repo (screenshot):

mega menu (messed up)

so the formatting gets messed up (and the final HTML is actually also different).

the file jquery-accessibleMegaMenu.js on the homepage has some differences like less comments and less code.

  • which version is newer?
  • can you synchronise the homepage and this repo?

Background of menu items gone in IE9.

Not sure why this is happening but in IE9, while using Accessible-Mega-Menu, the background of the menu item goes away. I can see the borders that are placed on the sub-nav component but the menu contents all have no background. It works correctly in IE 10, Chrome, Firefox and Safari it is just IE 9 that is having this problem. If I turn the absolute positioning off on the sub-menu div the menus show up but are taking up inline positioning which is bad. Please see attached screenshots.
screenshot 2014-03-11 15 46 21
screenshot 2014-03-11 15 46 31

Full Menu Display Flashes on load/refresh

I don't think this is the same issue described before as #4 Firefox flashing issue, but it sounds similar. Regardless I'm using the latest rendition of the code. I've run it in Chrome and Firefox and while Firefox is much worse, there is still a flicker even in Chrome where you see the whole branch of the hidden menu before is collapses into the mega-menu CSS display settings. Is just my testing environment or do others experience this? Any ideas in either case?

Update readme/docs about library invocation settings

I'm upgrading a site's old version of AMM to the most recent, and I ran into some behavior issues that could have been partially resolved if there was good documentation about the parameters you can send when invoking the library. I had to look through commits to find the "new" openOnMouseover option. It is not a big deal, just wanted to let you know in case some other people are struggling while getting this to work the way they expect.

Thanks for such great tool.

links don't work with Jaws screenreader

The links don't work with Jaws in IE. This makes the menu inaccessible with the most commonly used screenreader - browser combination worldwide.

Fails with:

  • Jaws 14 in IE9 on Windows 7
  • Jaws 15 in IE11 on Windows 7

The problem doesn't occur with Jaws in Firefox.
Also works nicely with VoiceOver and NVDA.

Script doesn't apply evenly to hidden elements that appear later

I'm working on a responsive design and for our desktop sites we're using this menu.

On a lower breakpoint, we hide the mega menu in favor of a condensed mobile navigation.

If a user loads the page so that the mega menu is hidden, then changes the viewport of the window so that it eclipses the breakpoint, the script is applied unevenly. In particular, the open class doesn't get added to the parent h2 when you have a panel open.

I cannot tell if this is desired behavior or not since some elements get the right items but some do not.

Top-level links not firing megamenu in Safari

Hello,

I hope someone might be able to help with this issue. We've used the Adobe Accessible Mega Menu code here https://www.liverpool.ac.uk/new-header/ and it works very well and fires the megamenu exactly as required on all browsers except Safari on Mac desktop. It's fine in iOS.

On clicking the Study with Liverpool/Our research/About us links, the JS should append a class of "open" which calls the CSS to display the megamenu content. This does not happen in Safari on Mac Desktop. Nothing at all seems to happen on click. Can anyone help us to debug it and find out why this is happening?

Many thanks

Create a release

Tag a release so we can reference a fixed point in the history easily.

Highlighting current position.

It seems like this is covered in 2.4.8 Location: 2.4.8 Location: Information about the user's location within a set of Web pages is available. (Level AAA).

However I'm unsure how you highlight their current position? I've tried adding the hover class on load, but it didn't work.

How can one set the nav element to "on" when they're on the current page?
TIA
-Aaron

Typing first character of link name doesn't seem to do anything

In your section about Keyboard Accessibility it states: "They can also be navigated with the arrow keys or by typing the first character in the link name, which speeds up keyboard navigation considerably. "

I'm using the latest Chrome on PC and typing the name doesn't seem to do anything for me. Navigating around with arrows and tabs works perfectly however.

Chrome bug breaking top level item links on touchscreen PCs

Sorry if this is the wrong place, but I spent hours yesterday digging into an issue. I am mostly reporting so others encountering this can feel a little more sane.. :)

Random Windows users were complaining that top level menu items were not clickable anymore. That is, they would not follow to their usual links, all they would do is open and close their submenus (or do nothing if they didn't have submenus).

After significant amounts of debugging, we found that they were all users with Windows devices with touchscreens (both laptops and desktops). "isTouch" was coming up as true on those devices and, for some reason, Chrome 47 is now triggering "ontouchstart" events even for mouse clicks. We believe this latter part is a bug in Chrome, but either way, it affects the accessible mega menu's operation when in "touch" mode.

Our workaround has been to hard code isTouch as false and now everything works fine, even on iOS and Android as both Safari and Chrome seem to be smart enough to deal with initial clicks representing hover states.

bootstrap

HI,
first of all I like this megamenu when I saw your example...but I can ask if this will work in bootstrap menu ? can I still Reuse Bootstrap navbar markup ?

Thank you in advance.

Multiple instances of the menu

If you initialize two or more instances of the accessible mega menu in the same page it gets all messed up.

The problem seems to be the menu variable inside _togglePanel. The context of this variable is always set to the last instance of the accessible mega menu, so it have to be reset.

This seems to do the trick (inside _togglePanel()):

menu = $(event.target).closest('.' + settings.menuClass); // correct context

Supporting touch devices

On touch devices, the script doesn’t let user hide previously opened dropdown menu.

In result, after you open the dropdown, it makes the content beneath it unreadable (user needs to reload the page to access the content).

Possible options:

  • hide after tapping submenu title
  • hide after tapping any area outside the dropdown

TypeError: that is null when hovering with mouse and using keyboard

Since the last bugfix I discovered a new bug. I have only had a chance to test this in Firefox 26.0, so not sure if it is isolated or not.

To reproduce the bug: hover over a top level menu item, once the menu expands, use the keyboard to navigate (arrows, alphanumeric keys, etc). The following error occurs:

TypeError: that is null
..../scripts/jquery-accessibleMegaMenu.js
Line 414

I realize this is a strange use case with mixing both inputs... so probably not a high priority fix. But, thought you should be aware of it. Thanks as always!!!

IE9 - shift + tab at top level nav-item causes exception...

To reproduce the error: tab to menu, expand a sub-nav level menu, (shift+tab) and you will see the javascript error. I found that it happens anytime you try to shift+tab out of a sub-nav menu and reach the top level nav-item element.

I was able to work-around it by adding a try{}catch{} to the var target declaration and exit the offending code. Sorry, I didn't dig deeper to find the cause and a more elegant solution. Let me know if I can help in any way. My evaluation of this plugin has been terrific up until this issue. Well done! If I could offer an enhancement suggestion... that would be to turn off the alpha-numeric navigation somehow. It's generally a great feature, but I had an instance where we wanted a menu to have a user input field and the alpha nav broke this capability (so I had to comment out the keyMap items which turned it off across the board). :( Anyway... great job! Thanks!!!!

Errors generated by IE that I noted while testing on your example site and in my dev environment:
Message: Unable to get property 'settings' of undefined or null reference
Line: 219
Char: 17
Code: 0
URI: http://adobe-accessibility.github.io/Accessible-Mega-Menu/js/jquery-accessibleMegaMenu.js

Message: Unable to get property 'topNavItemClass' of undefined or null reference
Line: 418
Char: 17
Code: 0
URI: http://localhost/tests/jquery-accessibleMegaMenu.js

Menu doesn't load in IE 8

Hello @majornista!

The commit that adds support for Windows 8 Narrator patters (SHA: d18e0d1) breaks the menu in IE8. You can see/reproduce this on the demo site in IE8. http://adobe-accessibility.github.io/Accessible-Mega-Menu/

The primary issue seems to be the new line 166. Apparently that particular function is not supported on the window object. Reverting line 66 removes the error so that the menu loads but generates other errors on mouseover. Reverting to the previous commit causes no errors.

Google and my JavaScript knowledge won't take me much farther but please let me know if I can assist in testing this..

Appearance on smaller screens

Usability on small screens could be vastly improved.

Low-hanging fruits:

  • Transform mega menu to 1 column
  • Hide content of sections keeping only subtitles and letting uses reveal the content if needed

Requires more work:
There’s a couple of mobile patterns which could be used here to avoid problems such as hiding the content beneath the dropdown.

Specific document structure required

The structure of my navigation has an extra element between the nav and the ul, and so breaks Accessible Mega Menu.

<nav>
  <div class="container">
    <ul class="navigationroot">
...
    </ul>
  </div>
</nav>

Potential options to fix this:

  1. At Line 708, use nav.find('.' + settings.menuClass').first() instead of nav.children().first(). This would require that the menu class exists already, though.
  2. Allow some sort of menuSelector option, and then at Line 708, use nav.find(settings.menuSelector).first().

openOnMouseover preventing scrolling out of open mega menu

Unsure if this is on purpose, but doesn't seem like an ideal UX. If the openOnMouseover is set to true, we can hover over the links to display the dropdown, but the downside is that if the dropdowns are quite large and the user tries to scroll down while the mega menu is still open, the browser will keep scrolling them back up to the mega menu with it still being focused.

Eg.. it should be visible in Chrome.

https://codepen.io/wplit/pen/QWvGZXZ

Video showing the issue.

https://www.loom.com/share/243ee7ec48c946eb940f409880b8fb5a

Top level menu item links do not work with touch-only device

When touched for the first time, top level items display their respective panel, but when touched for the second time (while panel is open) nothing happens.

The demo page does not work either for top level items links with tablets and smartphones.

I have tried numerous solutions messing up with _clickHandler function, but to no avail so far. Has anybody managed to make it work with tablets ans smartphones?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.