dotsunited-sliding-navigation
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -20,2 +20,4 @@ (function(window, factory) { | ||
var globalIdCounter = 0; | ||
return function(namespace, options) { | ||
@@ -32,5 +34,19 @@ namespace = namespace || 'dotsunited-sliding-navigation'; | ||
return $(this).children('a').eq(0).html(); | ||
}, | ||
openButtonLabel: function() { | ||
return $(this).children('a').eq(0).html(); | ||
} | ||
}, options); | ||
var labelledById = function(el) { | ||
var id = el.attr('id'); | ||
if (!id) { | ||
id = namespace + '-labelledby-' + (++globalIdCounter); | ||
el.attr('id', id); | ||
} | ||
return id; | ||
}; | ||
var parentClass = namespace + '__parent'; | ||
@@ -50,2 +66,3 @@ var visibleClass = namespace + '__visible'; | ||
.addClass(visibleClass + ' ' + scrollClass) | ||
.attr('tabindex', '0') | ||
.attr('aria-activedescendant', activeId) | ||
@@ -55,3 +72,2 @@ ; | ||
container.find('a') | ||
.attr('tabindex', '-1') | ||
.hover( | ||
@@ -79,5 +95,2 @@ function() { | ||
el.attr('aria-haspopup', 'true'); | ||
sub.attr('aria-expanded', 'false'); | ||
var openButtonElement = option( | ||
@@ -96,4 +109,7 @@ options.openButtonElement, | ||
sub.addClass(visibleClass); | ||
sub.attr('aria-expanded', 'true'); | ||
sub | ||
.addClass(visibleClass) | ||
.attr('aria-expanded', 'true') | ||
.attr('aria-hidden', 'false') | ||
; | ||
@@ -106,4 +122,6 @@ setTimeout(function() { | ||
var openButton = $(), labelledBy; | ||
if (openButtonElement) { | ||
$(openButtonElement) | ||
openButton = $(openButtonElement) | ||
.prependTo(el) | ||
@@ -115,5 +133,24 @@ .on('click', onOpenClick) | ||
if (option(options.openOnItemClick, this)) { | ||
el.on('click', '> a', onOpenClick); | ||
labelledBy = el | ||
.find('> a') | ||
.attr('aria-haspopup', 'true') | ||
.on('click', onOpenClick) | ||
; | ||
openButton | ||
.attr('aria-hidden', 'true') | ||
; | ||
} else { | ||
labelledBy = openButton | ||
.attr('aria-haspopup', 'true') | ||
.html(option(options.openButtonLabel, this)) | ||
; | ||
} | ||
sub | ||
.attr('aria-expanded', 'false') | ||
.attr('aria-hidden', 'true') | ||
.attr('aria-labelledby', labelledById(labelledBy)) | ||
; | ||
var backButtonElement = option( | ||
@@ -136,6 +173,10 @@ options.backButtonElement, | ||
.addClass(visibleClass) | ||
; | ||
sub.removeClass(scrollClass); | ||
sub.attr('aria-expanded', 'false'); | ||
sub | ||
.removeClass(scrollClass) | ||
.attr('aria-expanded', 'false') | ||
.attr('aria-hidden', 'true') | ||
; | ||
@@ -142,0 +183,0 @@ setTimeout(function() { |
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
348113
9671
17
2
0