-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
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
- Use a directive with
tpVariation="popper"andtpTrigger="mouseenter". - Continuously update another input (e.g.
[tpData]). - 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