Merge pull request #92 from nature/keyboard-access

Keyboard access
This commit is contained in:
Alex Kilgour
2016-01-26 14:38:08 +00:00
4 changed files with 31 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ module.exports = function (grunt) {
es3: false,
indent: 4,
latedef: false,
maxcomplexity: 4,
maxcomplexity: 6,
maxdepth: 2,
maxlen: 100,
maxparams: 4,

View File

@@ -288,4 +288,29 @@ $(document).ready(function(){
});
}
// Extend public/js/vendor/bootstrap/js/collapse.js
// Add keyboard control for filters
$.fn.collapse.Constructor.prototype.keydown = function (e) {
var $this = $(this);
var k = e.which || e.keyCode;
if (!/(13|32)/.test(k)) {
return;
}
if (k === 13 || k === 32) {
$this.click();
}
e.preventDefault();
e.stopPropagation();
};
$('[data-toggle="collapse"]').attr('role', 'button').attr('tabindex', 0);
$(document).on(
'keydown.collapse.data-api',
'[data-toggle="collapse"]',
$.fn.collapse.Constructor.prototype.keydown
);
});

File diff suppressed because one or more lines are too long