Tooltip | Add tooltipOptions support for form components
Describe the bug
If you use the tooltip on a non "input" component like "dropdown" and set the tooltip event to "focus", primeng will throw an error
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
because it can not correctly determine the target element for the tooltip.
Environment
Angular and PrimeNG running on Windows 10.
Reproducer
https://stackblitz.com/edit/1tgqew-mqukce?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.html
Angular version
^16.2.0
PrimeNG version
16.9.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.18.0
Browser(s)
Chrome Version 119.0.6045.160
Steps to reproduce the behavior
- Open Stackblitz Link
- Open the dev tools -> ERROR TypeError: Cannot read properties of null (reading 'addEventListener')
Expected behavior
Tooltip directive does not throw the error and correctly determines the target of the tooltip.
Hi,
Dropdown doesn't have 'tooltipOptions' support and tooltipEvent is not a property of dropdown. When you use pTooltip, you're not referring the tooltip input property of the dropdown, you're using pTooltip as a directive. pTooltip has the tooltipEvents property but dropdown doesn't support it. Solution would be adding tooltipOptions input property to the form components and passing it to the tooltip.
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap?
Thanks a lot for your understanding! Best Regards,