Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions js/jquery-accessibleMegaMenu.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ limitations under the License.
(function ($, window, document) {
"use strict";
var pluginName = "accessibleMegaMenu",
isRtl = ($('html').attr('dir') === 'rtl'),
defaults = {
uuidPrefix: "accessible-megamenu", // unique ID's are required to indicate aria-owns, aria-controls and aria-labelledby
menuClass: "accessible-megamenu", // default css class used to define the megamenu styling
Expand Down Expand Up @@ -125,6 +126,10 @@ limitations under the License.
190: "."
}
};

defaults.prevKey = isRtl ? Keyboard.RIGHT : Keyboard.LEFT,
defaults.nextKey = isRtl ? Keyboard.LEFT : Keyboard.RIGHT;

/**
* @desc Creates a new accessible mega menu instance.
* @param {jquery} element
Expand Down Expand Up @@ -489,7 +494,7 @@ limitations under the License.
found = ($(':tabbable:lt(' + $(':tabbable').index(target) + '):first').focus().length === 1);
}
break;
case Keyboard.RIGHT:
case defaults.nextKey:
event.preventDefault();
if (isTopNavItem) {
found = (topnavitems.filter(':gt(' + topnavitems.index(topli) + '):first').find(':tabbable:first').focus().length === 1);
Expand All @@ -504,7 +509,7 @@ limitations under the License.
}
}
break;
case Keyboard.LEFT:
case defaults.prevKey:
event.preventDefault();
if (isTopNavItem) {
found = (topnavitems.filter(':lt(' + topnavitems.index(topli) + '):last').find(':tabbable:first').focus().length === 1);
Expand Down