Skip to content

bug(MatTooltip): body line-height will affect tooltip gap #30132

Closed
@keatkeat87

Description

@keatkeat87

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

app.component.html

<button mat-button #matTooltip="matTooltip" matTooltip="Info about the action" style="background-color: pink;">Action</button>

styles.scss

body {
  line-height: 24px;
}

The problems:
there is a 1px gap between button and tooltip.
Image
if line-height 28px, the gap will become 2px.

Reproduction

StackBlitz link: https://stackblitz.com/github/keatkeat87/ng-mat-tooltips-gap-issue
Steps to reproduce:

  1. ng serve --open
  2. hover to button

Expected Behavior

no extra 1px gap.

Actual Behavior

there is a 1px extra gap

Environment

Angular CLI: 19.0.3
Node: 20.18.0
Package Manager: yarn 1.22.19
OS: win32 x64

Angular: 19.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1900.3
@angular-devkit/build-angular 19.0.3
@angular-devkit/core 19.0.3
@angular-devkit/schematics 19.0.3
@angular/cdk 19.0.2
@angular/material 19.0.2
@schematics/angular 19.0.3
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: material/tooltip

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions