Skip to content

ix-event-list: triggerFadeOut animates a null target, logging "No target found" on every child mutation #2689

Closed

Description

@wbarcik-etm

Bug: ix-event-list logs "No target found" from anime.js on every child mutation

Describe the bug

ix-event-list animates a null target on every DOM mutation of its children, logging this anime.js warning to the console:

No target found. Make sure the element you're trying to animate is accessible before creating your animation.

It fires even when animated is not set (i.e. false, the default). In an app that updates list contents from a WebSocket push, this floods the console.

Two separate defects in triggerFadeOut() combine to cause it. Both are present on main:
https://github.com/siemens/ix/blob/main/packages/core/src/components/event-list/event-list.tsx

private triggerFadeOut(): Promise<void> {
  return new Promise((resolve) => {
    if (!this.animated) {
      resolve();                    // (1) missing `return` — execution falls through
    }
    const listElement = this.hostElement.shadowRoot!.querySelector('ul');
    animate(listElement!, {         // (2) listElement is always null
      opacity: [{ opacity: 1, easing: 'easeInSine' }, { opacity: 0 }],
      duration: EventList.fadeOutDuration,
      onComplete: () => { resolve(); },
    });
  });
}

(1) Missing return after resolve(). Resolving a promise does not stop execution, so the animate() call runs regardless of animated. The intent was clearly an early exit — triggerFadeIn() directly above does it correctly with if (!this.animated) { return; }.

(2) querySelector('ul') never matches. render() emits a <div role="list">, not a <ul>:

render() {
  return (
    <Host class={{ ... }}>
      <div role="list">
        <slot></slot>
      </div>
    </Host>
  );
}

So listElement is always null, and the non-null assertion animate(listElement!, ...) hides it from the type checker. This means the fade-out animation never works at all, even for consumers who do set animated — the warning is just the visible symptom.

The trigger path is componentDidLoad() registering a subtree observer, whose callback calls triggerFadeOut() unconditionally:

this.mutationObserver.observe(this.hostElement, { childList: true, subtree: true });
private onMutation(mutationRecords: Array<MutationRecord>) {
  this.triggerFadeOut().then(() => { ... });
}

So any change to slotted content — adding, removing or re-rendering an ix-event-list-item — logs the warning.

Note that with animated false, resolve() is called synchronously before animate(), so the .then() continuation still runs and onMutation behaves correctly. The functional impact is limited to the console noise plus the dead fade-out; the onComplete resolve path is simply never reached.

Expected behavior

  • No console warning.
  • triggerFadeOut() returns early when animated is false.
  • When animated is true, the fade-out actually animates the rendered list container.

Steps to reproduce

  1. Render an ix-event-list with a few ix-event-list-item children, without setting animated.
  2. Add or remove a child item after the component has loaded (any framework re-render triggers this).
  3. Observe the warning in the browser console.

Minimal repro:

<ix-event-list item-height="S">
  <ix-event-list-item>one</ix-event-list-item>
</ix-event-list>
<script type="module">
  const list = document.querySelector('ix-event-list');
  // After componentDidLoad has registered the MutationObserver.
  setTimeout(() => {
    const item = document.createElement('ix-event-list-item');
    item.textContent = 'two';
    list.appendChild(item);   // -> "No target found" in the console
  }, 1000);
</script>

Suggested fix

private triggerFadeOut(): Promise<void> {
  return new Promise((resolve) => {
    if (!this.animated) {
      return resolve();
    }
    const listElement =
      this.hostElement.shadowRoot?.querySelector<HTMLElement>('[role="list"]');
    if (!listElement) {
      return resolve();
    }
    animate(listElement, {
      opacity: [{ opacity: 1, easing: 'easeInSine' }, { opacity: 0 }],
      duration: EventList.fadeOutDuration,
      onComplete: () => { resolve(); },
    });
  });
}

Dropping the two non-null assertions (shadowRoot!, listElement!) is what lets the compiler catch defect (2); it may be worth checking whether triggerFadeIn() and other querySelector sites in this component have the same latent mismatch.

Environment

  • @siemens/ix 4.0.0 (also verified against the current source on main; latest release 5.1.1)
  • Reproduced with the lazy loader build (@siemens/ix/loader); the same defect is present in the components/ custom-elements build.
  • Chromium-based browser.

Workaround

For anyone hitting this before a fix lands: patch triggerFadeOut on the component prototype to restore the early exit. With the lazy build, the registered custom element is a generated proxy that does not expose internal methods, so the real class has to be reached via the Stencil host ref of a live element:

const element = document.querySelector('ix-event-list');
const hostRef = element?.__stencil__getHostRef?.();
await hostRef?.$onInstancePromise$;
const instance = hostRef?.$lazyInstance$;
const prototype = instance && Object.getPrototypeOf(instance);
const original = prototype?.triggerFadeOut;

if (typeof original === 'function') {
  prototype.triggerFadeOut = function () {
    if (!this.animated) return Promise.resolve();
    return original.call(this);
  };
}

This relies on Stencil internals and only suppresses the warning — it does not make the fade-out work.

Activity

  1. wbarcik-etm commented on Aug 3, 2026

    @wbarcik-etm
    Author

    Reproduces on @siemens/ix@4.3.0 too.

  2. kathrinschalber commented on Aug 6, 2026

    @kathrinschalber
    Collaborator

    It's on our backlog: EIX-177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions