private isFocusable()

in src/focus.service.ts [576:608]


  private isFocusable(el: HTMLElement): boolean {
    if (el === this.selected) {
      return false;
    }
    // to prevent navigating to parent container elements with arc-focus-inside
    if (this.selected && el.contains(this.selected)) {
      return false;
    }

    //Dev note: el.tabindex is not consistent across browsers
    const tabIndex = el.getAttribute('tabIndex');
    if (!tabIndex || +tabIndex < 0) {
      return false;
    }

    const record = this.registry.find(el);
    if (record && record.excludeThis && record.excludeThis()) {
      return false;
    }

    if (this.registry.hasExcludedDeepElements()) {
      let parent: HTMLElement | null = el;
      while (parent) {
        const parentRecord = this.registry.find(parent);
        if (parentRecord && parentRecord.exclude && parentRecord.exclude()) {
          return false;
        }
        parent = parent.parentElement;
      }
    }

    return this.isVisible(el);
  }