|
|
@ -120,15 +120,15 @@ module.exports = function($window, $rootScope, $timeout, PathHelper) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// this could be extracted into a separate component if it grows
|
|
|
|
// this could be extracted into a separate component if it grows
|
|
|
|
var accessibleListSelector = 'table.list, table.keyboard-accessible-list'; |
|
|
|
var accessibleListSelector = 'table.keyboard-accessible-list'; |
|
|
|
var accessibleRowSelector = 'table.list tr, table.keyboard-accessible-list tr'; |
|
|
|
var accessibleRowSelector = 'table.keyboard-accessible-list tbody tr'; |
|
|
|
|
|
|
|
|
|
|
|
function findListInPage() { |
|
|
|
function findListInPage() { |
|
|
|
var domLists, focusElements; |
|
|
|
var domLists, focusElements; |
|
|
|
focusElements = []; |
|
|
|
focusElements = []; |
|
|
|
domLists = angular.element(accessibleListSelector); |
|
|
|
domLists = angular.element(accessibleListSelector); |
|
|
|
domLists.find('tbody tr').each(function(index, tr){ |
|
|
|
domLists.find('tbody tr').each(function(index, tr){ |
|
|
|
var firstLink = angular.element(tr).find(':visible:tabbable:not(.toggle-all, input)')[0]; |
|
|
|
var firstLink = angular.element(tr).find(':visible:tabbable')[0]; |
|
|
|
if ( firstLink !== undefined ) { focusElements.push(firstLink); } |
|
|
|
if ( firstLink !== undefined ) { focusElements.push(firstLink); } |
|
|
|
}); |
|
|
|
}); |
|
|
|
return focusElements; |
|
|
|
return focusElements; |
|
|
@ -137,14 +137,19 @@ module.exports = function($window, $rootScope, $timeout, PathHelper) { |
|
|
|
function focusItemOffset(offset) { |
|
|
|
function focusItemOffset(offset) { |
|
|
|
var list, index; |
|
|
|
var list, index; |
|
|
|
list = findListInPage(); |
|
|
|
list = findListInPage(); |
|
|
|
|
|
|
|
|
|
|
|
if (list === null) { return; } |
|
|
|
if (list === null) { return; } |
|
|
|
index = list.indexOf( |
|
|
|
index = list.indexOf( |
|
|
|
angular |
|
|
|
angular |
|
|
|
.element(document.activeElement) |
|
|
|
.element(document.activeElement) |
|
|
|
.parents(accessibleRowSelector) |
|
|
|
.closest(accessibleRowSelector) |
|
|
|
.find(':visible:tabbable:not(input)')[0] |
|
|
|
.find(':visible:tabbable')[0] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var target = angular.element(list[(index+offset+list.length) % list.length]) |
|
|
|
|
|
|
|
|
|
|
|
angular.element(list[(index+offset+list.length) % list.length]).focus(); |
|
|
|
angular.element(list[(index+offset+list.length) % list.length]).focus(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function focusNextItem() { |
|
|
|
function focusNextItem() { |
|
|
|