Skip to content

feat(MatTooltip): Mimic native tooltip behaviour #20091

Open
@tuhinkarmakar

Description

@tuhinkarmakar

Feature Description

If nested elements have MatTooltips applied on them, show the innermost tooltip.

Suppose we have a button with a span inside it.

<button mat-raised-button matTooltip="Button tooltip">
  <span matTooltip="Span tooltip">Mat Tooltip</span>
</button>

<button mat-raised-button title="Button tooltip">
  <span title="Span tooltip">Native Tooltip</span>
</button>

If both of these elements have the title attribute applied to them and we hover the span, the browser shows title text of the span.
However, if we use the MatTooltip directive, both tooltips are shown to the user.

Minimal Reproduction on StackBlitz

Use Case

Whenever you need to show different tooltips for parent and child elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/tooltipfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions