Skip to content

Bug: tpTrigger input ignored on updates #191

@bryanttfeliciano-orq

Description

@bryanttfeliciano-orq

Bug: tpTrigger input ignored on updates

Description
When tpTrigger="mouseenter" is set in a template, it works initially but flips to click after other inputs (e.g. tpData, tpIsEnabled) update. This happens because ngOnChanges rebuilds props from the variation + only the changed inputs, so unchanged inputs like tpTrigger get dropped.

Expected behavior
Template inputs (e.g. tpTrigger) should always override variation defaults and remain stable across updates.

Actual behavior
On updates where tpTrigger doesn’t change, it’s excluded from the new props object. The trigger then falls back to variation/defaults, often switching to click on touch-capable devices.

Steps to reproduce

  1. Use a directive with tpVariation="popper" and tpTrigger="mouseenter".
  2. Continuously update another input (e.g. [tpData]).
  3. Observe that the tooltip still shows, but the trigger behavior flips to click.

Root cause
ngOnChanges currently merges like this:

const props = Object.keys(changes)
  .filter(key => key !== 'isVisible')
  .reduce((acc, key) => ({ ...acc, [key]: changes[key].currentValue }),
          { ...this.globalConfig.variations?.[variation] });
this.updateProps(props);

Workaround
We are currently monkey-patching this in our project by forcing props.trigger = this.trigger() in ngOnChanges

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions