diff --git a/.gitignore b/.gitignore index a7e5276..2a0e95b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules .sass-cache .htaccess +*.map # Compiled source # ################### diff --git a/LICENSE.txt b/LICENSE.txt index 848a0b1..198d366 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Christopher Yee +Copyright (c) 2017 Christopher Yee http://www.christopheryee.ca Permission is hereby granted, free of charge, to any person obtaining diff --git a/README.md b/README.md index 3ad8472..463d805 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,21 @@ Download the [packaged source file](https://github.com/christophery/pushy/archiv ```html @@ -55,7 +57,7 @@ Download the [packaged source file](https://github.com/christophery/pushy/archiv
- +
``` @@ -74,10 +76,12 @@ bower install pushy ```html ``` @@ -135,12 +139,14 @@ $menu_width: 400px; ```html ``` @@ -154,18 +160,55 @@ html, body{ } ``` +- Use the `data-focus` attribute to give focus to a link when Pushy is opened. Ideally the first link of the menu should be focused. For example `.home-page` or `#profile-page`. + +```html + +``` + ##Browser Compatibility | Desktop | Mobile | | ------------- | -------------------------------------------| -| IE 9-11 | Chrome (Android 4.x+) | -| MS Edge | Safari (iOS 9) | +| IE 9-11 | Chrome (Android) | +| MS Edge | Safari (iOS) | | Chrome | | Firefox | | Safari (Mac) | ##Version History +1.1.0 + +- Accessiblity (a11y) enhancements: +a) Can access and use menu with keyboard navigation. +b) Can use the escape key to close the menu when opened. +c) Changed the empty submenu links to buttons. +d) Added `data-focus` attribute to allow user to specify a link to focus on when menu is opened. +e) Added `.pushy-content` element to menu structure (fixes visibility flickering). +f) Changed `.menu-btn` div to button. + +- Removed some redundant CSS classes from `pushy.css`. +- Removed `toggleSubmenuFallback` function, older browsers will use `toggleSubmenu` instead. +- Fixed issue #88 + 1.0.0 - Added auto-collapsable submenus. diff --git a/css/demo.css b/css/demo.css index ea9b116..57674c0 100644 --- a/css/demo.css +++ b/css/demo.css @@ -1,6 +1,4 @@ html, body { - -webkit-tap-highlight-color: transparent; - /* disable webkit tap highlight */ overflow-x: hidden; } @@ -26,6 +24,7 @@ ul { color: #FFF; text-align: center; cursor: pointer; + border: 0px; } .menu-btn:hover { opacity: 0.6; diff --git a/css/demo.css.map b/css/demo.css.map deleted file mode 100644 index 80c58a3..0000000 --- a/css/demo.css.map +++ /dev/null @@ -1,7 +0,0 @@ -{ -"version": 3, -"mappings": "AAAA,UAAU;EACT,2BAA2B,EAAE,WAAa;EAAE,kCAAkC;EAC9E,UAAU,EAAE,MAAM;;;AAGnB,WAAW;AAEX,EAAE;EACE,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;;;AAGd,eAAe;AAEf,UAAU;EACT,QAAQ,EAAE,QAAQ;EAClB,OAAO,EAAE,SAAS;EAClB,WAAW,EAAE,IAAI;;;AAGlB,iBAAiB;AAEjB,SAAS;EACR,KAAK,EAAE,KAAK;EACZ,OAAO,EAAE,IAAI;EACb,aAAa,EAAE,IAAI;EACnB,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,MAAM;EAClB,MAAM,EAAE,OAAO;;AAEf,eAAO;EACN,OAAO,EAAE,GAAG;;;AAId,YAAY;AAEZ,YAAY;EACX,QAAQ,EAAE,KAAK;EACf,UAAU,EAAE,IAAI;EAChB,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,MAAM;EACf,UAAU,EAAE,MAAM;EAClB,OAAO,EAAE,IAAI;;;AAGd,YAAY;AAEZ,YAAY;EACX,QAAQ,EAAE,QAAQ;EAClB,UAAU,EAAE,cAAc;EAC1B,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,IAAI;EACb,SAAS,EAAE,KAAK;EAChB,UAAU,EAAE,MAAM", -"sources": ["../scss/demo.scss"], -"names": [], -"file": "demo.css" -} diff --git a/css/normalize.css b/css/normalize.css index 6e8e42d..8dea90e 100644 --- a/css/normalize.css +++ b/css/normalize.css @@ -96,14 +96,6 @@ body { Links ========================================================================== */ -/** - * Address `outline` inconsistency between Chrome and other browsers. - */ - -a:focus { - outline: thin dotted; -} - /** * Improve readability when focused and also mouse hovered in all browsers. */ diff --git a/css/pushy.css b/css/pushy.css index fe33ae8..67fc0dc 100644 --- a/css/pushy.css +++ b/css/pushy.css @@ -1,4 +1,4 @@ -/*! Pushy - v1.0.0 - 2016-3-1 +/*! Pushy - v1.1.0 - 2017-1-30 * Pushy is a responsive off-canvas navigation menu using CSS transforms & transitions. * https://github.com/christophery/pushy/ * by Christopher Yee */ @@ -11,7 +11,6 @@ z-index: 9999; background: #191918; overflow: auto; - visibility: hidden; -webkit-overflow-scrolling: touch; /* enables momentum scrolling in iOS overflow elements */ } @@ -20,7 +19,6 @@ color: #b3b3b1; padding: 15px 30px; text-decoration: none; - outline: 0; } .pushy a:hover { color: #FFF; @@ -35,6 +33,10 @@ right: 0; } +.pushy-content { + visibility: hidden; +} + /* Menu Movement */ .pushy-left { -webkit-transform: translate3d(-200px, 0, 0); @@ -68,6 +70,10 @@ -ms-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } +.pushy-open-left .pushy-content, +.pushy-open-right .pushy-content { + visibility: visible; +} /* Menu Transitions */ #container, @@ -76,6 +82,10 @@ transition: transform 0.2s cubic-bezier(0.16, 0.68, 0.43, 0.99); } +.pushy-content { + transition: visibility 0.2s cubic-bezier(0.16, 0.68, 0.43, 0.99); +} + /* Site Overlay */ .site-overlay { display: none; @@ -113,19 +123,33 @@ } /* Submenu Appearance */ .pushy-submenu { + /* Submenu Buttons */ /* Submenu Icon */ } .pushy-submenu ul { padding-left: 15px; - transition: max-height 0.2s ease-in-out; + transition: max-height 0.2s ease-in-out, visibility 0.2s ease-in-out; } .pushy-submenu ul .pushy-link { transition: opacity 0.2s ease-in-out; } -.pushy-submenu > a { +.pushy-submenu button { + width: 100%; + color: #b3b3b1; + padding: 15px 30px; + text-align: left; + background: transparent; + border: 0; +} +.pushy-submenu button:hover { + color: #FFF; +} +.pushy-submenu > a, +.pushy-submenu > button { position: relative; } -.pushy-submenu > a::after { +.pushy-submenu > a::after, +.pushy-submenu > button::after { content: ''; display: block; height: 11px; @@ -144,6 +168,7 @@ .pushy-submenu-closed ul { max-height: 0; overflow: hidden; + visibility: hidden; } .pushy-submenu-closed .pushy-link { opacity: 0; @@ -154,19 +179,16 @@ } .pushy-submenu-open ul { max-height: 1000px; + visibility: visible; } .pushy-submenu-open .pushy-link { opacity: 1; } -.pushy-submenu-open a::after { +.pushy-submenu-open a::after, +.pushy-submenu-open button::after { -webkit-transform: translateY(-50%) rotate(90deg); -ms-transform: translateY(-50%) rotate(90deg); transform: translateY(-50%) rotate(90deg); } -.no-csstransforms3d .pushy-submenu-closed ul { - max-height: none; - display: none; -} - /*# sourceMappingURL=pushy.css.map */ diff --git a/css/pushy.css.map b/css/pushy.css.map deleted file mode 100644 index 52b89a3..0000000 --- a/css/pushy.css.map +++ /dev/null @@ -1,7 +0,0 @@ -{ -"version": 3, -"mappings": "AAAA;;;uBAGuB;AAIvB,qBAAqB;AAErB,MAAM;EACF,QAAQ,EAAE,KAAK;EACf,KAAK,EANI,KAAK;EAOd,MAAM,EAAE,IAAI;EACZ,GAAG,EAAE,CAAC;EACN,OAAO,EAAE,IAAI;EACb,UAAU,EAAE,OAAO;EACnB,QAAQ,EAAE,IAAI;EACd,UAAU,EAAE,MAAM;EAClB,0BAA0B,EAAE,KAAK;EAAE,yDAAyD;;AAE5F,QAAC;EACG,OAAO,EAAE,KAAK;EACd,KAAK,EAAE,OAAO;EACd,OAAO,EAAE,SAAS;EAClB,eAAe,EAAE,IAAI;EACrB,OAAO,EAAE,CAAC;;AAGd,cAAO;EACH,KAAK,EAAE,IAAI;;AAGf,qBAAc;EACV,UAAU,EAAE,IAAI;;AAGpB,iBAAY;EACR,IAAI,EAAE,CAAC;;AAGX,kBAAa;EACT,KAAK,EAAE,CAAC;;;AAIhB,mBAAmB;AAEnB,WAAW;EACP,iBAAiB,EA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X,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,IAAI;EACZ,KAAK,EAAE,GAAG;EACV,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,GAAG;EACR,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,iCAAiC;EAC7C,iBAAiB,EAAE,gBAAgB;EACnC,aAAa,EAAE,gBAAgB;EAC/B,SAAS,EAAE,gBAAgB;EAC3B,UAAU,EAAE,cAAc;;;AAIlC,sBAAsB;AAGlB,wBAAE;EACE,UAAU,EAAE,CAAC;EACb,QAAQ,EAAE,MAAM;;AAGpB,iCAAW;EACP,OAAO,EAAE,CAAC;;;AAIlB,mBAAmB;EASf,kBAAkB;;AARlB,sBAAE;EACE,UAAU,EAAE,MAAM;;AAGtB,+BAAW;EACP,OAAO,EAAE,CAAC;;AAKd,4BAAS;EACL,iBAAiB,EAAE,8BAA8B;EACjD,aAAa,EAAE,8BAA8B;EAC7C,SAAS,EAAE,8BAA8B;;;AAMzC,4CAAE;EACE,UAAU,EAAE,IAAI;EAChB,OAAO,EAAE,IAAI", -"sources": ["../scss/pushy.scss"], -"names": [], -"file": "pushy.css" -} diff --git a/demo.html b/demo.html index ef2f600..f3cc371 100644 --- a/demo.html +++ b/demo.html @@ -18,46 +18,49 @@ + -