update shared components

This commit is contained in:
Luke Pulverenti 2016-08-23 13:07:50 -04:00
parent 0ad08c389c
commit 6ab4b313a1
52 changed files with 652 additions and 21 deletions

View file

@ -24,7 +24,7 @@ define(['dom'], function (dom) {
}
if (defaultToFirst !== false) {
element = getFocusableElements(view)[0];
element = getFocusableElements(view, 1)[0];
if (element) {
focus(element);
@ -117,7 +117,7 @@ define(['dom'], function (dom) {
return scopes[0] || document.body;
}
function getFocusableElements(parent) {
function getFocusableElements(parent, limit) {
var elems = (parent || getDefaultScope()).querySelectorAll(focusableQuery);
var focusableElements = [];
@ -127,6 +127,10 @@ define(['dom'], function (dom) {
if (isCurrentlyFocusableInternal(elem)) {
focusableElements.push(elem);
if (limit && focusableElements.length >= limit) {
break;
}
}
}