New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dotsunited-off-canvas-navigation

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotsunited-off-canvas-navigation - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

demo/_src/index.js

85

lib/setup.js

@@ -12,2 +12,4 @@ (function(window, factory) {

}(typeof window !== 'undefined' ? window : this, function(window, $) {
var $document = $(window.document);
return function(namespace) {

@@ -19,14 +21,79 @@ var toggleSelector = '[data-' + namespace + '-toggle]';

$(window.document)
function open(toggle, panel) {
root.addClass(openClass);
toggle
.attr('aria-expanded', 'true')
.trigger(namespace + ':' + 'open', [toggle, panel])
;
panel
.attr('aria-hidden', 'false')
.removeAttr('hidden')
.attr('tabindex', -1)
.scrollTop(0)
.focus()
;
$document
.on('keydown.' + namespace + '-internal', function(e) {
if (e.keyCode !== 27) {
return;
}
close(toggle, panel);
})
.on('click.' + namespace + '-internal', function(e) {
if (panel.index(e.target) >= 0 || $.contains(panel.get(0), e.target)) {
return;
}
close(toggle, panel);
})
;
}
function close(toggle, panel) {
$document
.off('.' + namespace + '-internal')
;
root.removeClass(openClass);
panel
.attr('aria-hidden', 'true')
.attr('hidden', 'true')
.removeAttr('tabindex')
.blur()
;
toggle
.attr('aria-expanded', 'false')
.focus()
.trigger(namespace + ':' + 'open', [toggle, panel])
;
}
$document
.on('click.' + namespace, toggleSelector, function(e) {
var toggle = $(this);
var target = toggle.attr('href');
if (!target) {
target = '#' + toggle.attr('aria-controls');
}
var panel = $(target);
if (!panel.length) {
return;
}
e.preventDefault();
var expanded = root
.toggleClass(openClass)
.hasClass(openClass)
;
$(toggleSelector)
.attr('aria-expanded', (expanded ? 'true' : 'false'))
.trigger(namespace + ':' + (expanded ? 'open' : 'close'), [this]);
if (root.hasClass(openClass)) {
close(toggle, panel);
} else {
open(toggle, panel);
}
})

@@ -33,0 +100,0 @@ ;

@@ -8,5 +8,5 @@ {

"email": "jan.sorgalla@dotsunited.de",
"url" : "https://dotsunited.de"
"url": "https://dotsunited.de"
},
"version": "2.1.1",
"version": "2.2.0",
"repository": {

@@ -19,3 +19,16 @@ "type": "git",

"jquery": ">=1.7"
},
"devDependencies": {
"css-loader": "^0.23.1",
"file-loader": "^0.9.0",
"jquery": "^1.12.4",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.1"
},
"scripts": {
"build-demo": "webpack --config demo/_src/webpack.config.js --progress --profile --colors"
}
}

38

README.md

@@ -40,29 +40,21 @@ Off-Canvas Navigation

If it's the only primary navigation menu on the page:
```html
<a aria-controls="off-canvas-navigation-menu" aria-expanded="false" href="#off-canvas-navigation-menu" role="button" class="off-canvas-navigation-button" data-off-canvas-navigation-toggle>
<button
aria-label="Open navigation"
aria-controls="off-canvas-navigation-menu"
aria-expanded="false"
class="off-canvas-navigation-button"
data-off-canvas-navigation-toggle
>
<span><span></span></span>
</a>
<div aria-hidden="true" class="off-canvas-navigation-backdrop" data-off-canvas-navigation-toggle></div>
<nav id="off-canvas-navigation-menu" class="off-canvas-navigation-menu">
<ul>
<li>...</li>
</ul>
</nav>
```
If there are more than one primary navigation menus, hiding the off-canvas menu
completely for screen readers:
```html
<button aria-hidden="true" class="off-canvas-navigation-button" data-off-canvas-navigation-toggle>
<span></span>
</button>
<div aria-hidden="true" class="off-canvas-navigation-backdrop" data-off-canvas-navigation-toggle></div>
<div aria-hidden="true" class="off-canvas-navigation-backdrop"></div>
<nav aria-hidden="true" id="off-canvas-navigation-menu" class="off-canvas-navigation-menu">
<div
id="off-canvas-navigation-menu"
aria-hidden="true"
hidden
class="off-canvas-navigation-menu"
>
<ul>

@@ -98,3 +90,3 @@ <li>...</li>

Copyright (c) 2015 Dots United GmbH.
Copyright (c) 2015-2016 Dots United GmbH.
Released under the [MIT](LICENSE?raw=1) license.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc