private setDefaultFocus()

in src/focus.service.ts [632:648]


  private setDefaultFocus(scrollSpeed: number | null = this.scrollSpeed) {
    const focusableElems = this.focusRoot.querySelectorAll('[tabIndex]');
    for (let i = 0; i < focusableElems.length; i += 1) {
      const potentialElement = <HTMLElement>focusableElems[i];
      if (this.selected === potentialElement || !this.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, scrollSpeed);
      return;
    }
  }