in src/focus-service.ts [225:247]
public setDefaultFocus() {
if (this.root.element.contains(this.elementStore.element)) {
return;
}
const focusableElems = this.root.element.querySelectorAll('[tabIndex]');
// tslint:disable-next-line
for (let i = 0; i < focusableElems.length; i += 1) {
const potentialElement = focusableElems[i] as HTMLElement;
if (this.elementStore.element === potentialElement || !isFocusable(potentialElement)) {
continue;
}
const potentialRect = roundRect(potentialElement.getBoundingClientRect());
// Skip elements that have either a width of zero or a height of zero
if (potentialRect.width === 0 || potentialRect.height === 0) {
continue;
}
this.selectNode(potentialElement);
return;
}
}