Skip to content

Commit

Permalink
Merge pull request #78 from chriswiggins/master
Browse files Browse the repository at this point in the history
Disable list expansion if aria-disabled is true on link element
  • Loading branch information
onokumus committed Jan 8, 2016
2 parents aaa0c7c + 333b6f2 commit e6eb8ec
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ composer require onokumus/metismenu:dev-master

```javascript
$("#menu").metisMenu();
```
```


### Options

Expand Down Expand Up @@ -191,6 +192,14 @@ Prevents or allows dropdowns' onclick events after expanding/collapsing.
});
```

### Stopping list opening on certain elements
Setting aria-disabled="true" in the `<a>` element as shown will stop metisMenu opening the menu for that particular list. This can be changed dynamically and will be obeyed correctly:

```html
<a href="#" aria-expanded="false" aria-disabled="true">List 1</a>
```


### Testing
```bash
npm install
Expand All @@ -217,6 +226,7 @@ Contains a simple HTML file to demonstrate metisMenu plugin.

### Release History
**DATE** **VERSION** **CHANGES**
* 2016-01-08 v2.3.0 Adding aria-disabled=true to the link element prevents the dropdown from opening
* 2015-09-27 v2.2.0 Events supported & added preventDefault options
* 2015-08-06 v2.1.0 RTL & `aria-expanded` attribute & TypeScript type definitions support
* 2015-07-25 v2.0.3 When the active item has doubleTapToGo should not collapse
Expand Down
6 changes: 3 additions & 3 deletions dist/metisMenu.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* metismenu - v2.2.0
* metismenu - v2.3.0
* A jQuery menu plugin
* https://github.com/onokumus/metisMenu#readme
*
Expand Down Expand Up @@ -94,6 +94,6 @@
-o-transition-duration: .35s;
transition-duration: .35s;
-webkit-transition-property: height, visibility;
-o-transition-property: height, visibility;
transition-property: height, visibility;
-o-transition-property: height, visibility;
transition-property: height, visibility;
}
5 changes: 4 additions & 1 deletion dist/metisMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* metismenu - v2.2.0
* metismenu - v2.3.0
* A jQuery menu plugin
* https://github.com/onokumus/metisMenu#readme
*
Expand Down Expand Up @@ -128,6 +128,9 @@
if($this.options.preventDefault){
e.preventDefault();
}
if(self.attr('aria-disabled') === 'true'){
return;
}
if ($parent.hasClass(activeClass) && !$this.options.doubleTapToGo) {
$this.hide($list);
self.attr('aria-expanded',false);
Expand Down
2 changes: 1 addition & 1 deletion dist/metisMenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/metisMenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metismenu",
"version": "2.2.0",
"version": "2.3.0",
"description": "A jQuery menu plugin",
"main": "./dist/metisMenu.js",
"scripts": {
Expand Down Expand Up @@ -29,7 +29,8 @@
"Andrew Eastwood (https://github.com/AndrewEastwood)",
"Marcelo Tosco <[email protected]> (http://ecapy.com)",
"Radoslav Štofko (http://www.stoweb.cz)",
"Umut Karcı <[email protected]>"
"Umut Karcı <[email protected]>",
"Chris Wiggins <[email protected]> (https://github.com/chriswiggins)"
],
"license": "MIT",
"bugs": {
Expand Down
3 changes: 3 additions & 0 deletions src/metisMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
if($this.options.preventDefault){
e.preventDefault();
}
if(self.attr('aria-disabled') === 'true'){
return;
}
if ($parent.hasClass(activeClass) && !$this.options.doubleTapToGo) {
$this.hide($list);
self.attr('aria-expanded',false);
Expand Down

0 comments on commit e6eb8ec

Please sign in to comment.