Close sub menu when hitting TAB

Home Forums Older releases 0.9.x Close sub menu when hitting TAB

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2376
    Moe
    Participant

    How i can hide all sub menus when hitting tab to navigate between menu items. I’ve tried setting showOnClick = true and hideOnClick=false. that didn’t do it.

    i just need the sub menu to be available once the user clicks ENTER or on MOUSE HOVER.

    Thanks

    #2385
    admin
    Keymaster

    Hi Moe,

    This is coming soon in the first 1.0.0 beta (along with some other accessibility improvements). By default the tab order will not include the sub menus any more – only if you activate some sub menu via Enter. And you could also deactivate the subs again via Escape.

    If you cannot wait for it, I can try to prepare some instructions how to backport it to the current v0.9.7 but you will need to edit manually the “jquery.smartmenus.js” file. Just let me know.

    #2389
    Moe
    Participant

    Thank for being so responsive! If you can provide some instruction that would be perfect!

    #2408
    sadiem
    Participant

    I would appreciate those instructions for backporting also, please.

    #2412
    admin
    Keymaster

    OK, here are quick instructions for v0.9.7:

    1) In “sm-core-css.css” replace the following line:

    ul.sm ul{position:absolute;top:-999999px;width:100px;}

    with the following:

    ul.sm ul{display:none;position:absolute;}

    2) In “jquery.smartmenus.js” replace the following:

    (!this.isTouchMode() ||

    with the following:

    this.focusActivated && (!this.isTouchMode() ||

    3) In “jquery.smartmenus.js” replace all occurrences of the following:

    this.clickActivated = false;

    with the following:

    this.clickActivated = false;
    this.focusActivated = false;

    4) In “jquery.smartmenus.js” find the current “itemClick” method and replace it with the following:

    			itemClick: function(e) {
    				if (this.isTouchScrolling) {
    					this.isTouchScrolling = false;
    					e.stopPropagation();
    					return false;
    				}
    				var $a = $(e.currentTarget);
    				if (!this.handleItemEvents($a)) {
    					return;
    				}
    				$a.removeDataSM('mousedown');
    				if (this.$root.triggerHandler('click.smapi', $a[0]) === false) {
    					return false;
    				}
    				// undo fix: prevent the address bar on iPhone from sliding down when expanding a sub menu
    				if ($a.dataSM('href')) {
    					$a.attr('href', $a.dataSM('href')).removeDataSM('href');
    				}
    				var $sub = $a.parent().dataSM('sub');
    				// if the sub is not visible
    				if ($sub && (!$sub.dataSM('shown-before') || !$sub.is(':visible'))) {
    					// try to activate the item and show the sub
    					this.itemActivate($a);
    					// if "itemActivate" showed the sub, prevent the click so that the link is not loaded
    					// if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded
    					if ($sub.is(':visible')) {
    						this.focusActivated = true;
    						return false;
    					}
    				} else if (this.opts.showOnClick && $a.parent().parent().dataSM('level') == 1 && $sub) {
    					this.clickActivated = true;
    					this.menuShow($sub);
    					return false;
    				}
    				if ($a.hasClass('disabled')) {
    					return false;
    				}
    				if (this.$root.triggerHandler('select.smapi', $a[0]) === false) {
    					return false;
    				}
    			},

    Cheers!

    #2428
    Moe
    Participant

    Thanks Buddy. Appreciated.

    #2429
    mushtaqsiddique
    Participant

    Good Morning,
    Thanks for such a great example and a beautiful menu!
    Can i add this on my clients website and include the license in the root of the website ?
    Just wanted to make sure!
    Please let me know.

    #2430
    admin
    Keymaster

    Can i add this on my clients website and include the license in the root of the website ?
    Just wanted to make sure!
    Please let me know.

    Yes, of course.

    #2431
    mushtaqsiddique
    Participant

    Thanks a lot for a quick reply!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?