Skip to content

Feat/add html rendering logic in tooltips#60

Merged
AhsanAyaz merged 3 commits into
IOMechs:masterfrom
Annas03:feat/add-html-rendering-logic-in-tooltips
Jun 4, 2026
Merged

Feat/add html rendering logic in tooltips#60
AhsanAyaz merged 3 commits into
IOMechs:masterfrom
Annas03:feat/add-html-rendering-logic-in-tooltips

Conversation

@Annas03
Copy link
Copy Markdown
Contributor

@Annas03 Annas03 commented Jun 3, 2026

Feature: Added Rendering of HTML content inside Tooltips and make the tooltips hoverable

Added a config for configuring how the content inside the tooltip being shown, i.e plain text or as HTML.

Why need for this Feature

In ICplan we have a requirement that the Channel Description's(tooltip content) can contain hyperlinks
image

@AhsanAyaz
Copy link
Copy Markdown
Contributor

Thanks for the contribution! Here is some feedback from the review of this PR:

1. Angular Version/Rebase Conflict

The branch is currently based on an older commit (from when the library was on Angular 8). Since master has been upgraded to Angular 15, merging this directly would lead to dependency version mismatches or regressions. Please rebase your branch on the latest master to resolve package version conflicts.

2. Transition Delay for Hovering Over Tooltips

In dropdown.component.ts (hideTooltip()):

    if (this.config.renderTooltipAsHtml) {
      // give the pointer time to travel onto the tooltip to click links inside it
      this.tooltipHideTimeout = setTimeout(() => {
        this.inputTooltipShown = false;
      }, 0) as unknown as number;
    }

A delay of 0ms executes on the next event loop tick. Because there is a gap between the list item and the overlay, this doesn't give the mouse pointer enough physical time to cross the boundary. We should change this to a reasonable delay (e.g., 200ms - 300ms) or make it a configurable value (e.g. tooltipHideDelay in AngularTagsInputConfig).

3. Missing Tooltip Origin in Default Template

In the default template inside dropdown.component.html, the list items don't pass the origin argument:

(mouseenter)="showTooltip(item[config.hoverProperty])"

Because the second argument origin is undefined, inputTooltipOverlayOrigin is set to undefined, which prevents the CDK overlay tooltip from positioning correctly for the default template. We should add cdkOverlayOrigin #onHoverTrigger="cdkOverlayOrigin" and pass onHoverTrigger to showTooltip().

4. XSS Security with [innerHTML]

Since renderTooltipAsHtml enables raw HTML rendering via [innerHTML], it poses a potential security risk if the tooltip text contains user-provided or untrusted inputs. We should document this security consideration clearly.

@Annas03 Annas03 force-pushed the feat/add-html-rendering-logic-in-tooltips branch from e5e587e to 58a1946 Compare June 4, 2026 10:15
@Annas03
Copy link
Copy Markdown
Contributor Author

Annas03 commented Jun 4, 2026

Incorporated your comments in the Code, Can you have a look, Thanks.

Copy link
Copy Markdown
Contributor

@AhsanAyaz AhsanAyaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All feedback addressed. The rebase looks good, transition delay is corrected, and cdkOverlayOrigin was added to the default template. Excellent work!

@AhsanAyaz AhsanAyaz merged commit bd3c0c1 into IOMechs:master Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants