private bubbleEvent()

in src/focus-service.ts [188:220]


  private bubbleEvent(
    ev: ArcEvent,
    trigger: keyof IArcHandler,
    source: HTMLElement | null,
  ): ArcEvent {
    for (
      let el = source;
      !propogationStoped(ev) && el !== this.root.element && el;
      el = el.parentElement
    ) {
      if (el === undefined) {
        // tslint:disable-next-line
        console.warn(
          `arcade-machine focusable element was moved outside of` +
            'the focus root. We may not be able to handle focus correctly.',
          el,
        );
        break;
      }

      const directive = this.registry.find(el);
      if (!directive) {
        continue;
      }

      const fn = directive[trigger] as (ev: ArcEvent) => void;
      if (fn) {
        fn(ev);
      }
    }

    return ev;
  }