components icon indicating copy to clipboard operation
components copied to clipboard

bug(MatTooltip): Multiline mat-tooltip on mat-table cell is not working

Open harshadray opened this issue 6 years ago • 4 comments

Reproduction

StackBlitz: https://stackblitz.com/edit/angular-4mtwsw Steps to reproduce:

  1. Open a stackblitz and hover over on 'No.'(Number) column of table
  2. you will see that, tooltip is not break on second line.

Expected Behavior

  • It should break in second line.

Actual Behavior

  • Its working for button and span but not on mat-table cell.

Environment

  • Angular: 8.2.14
  • CDK/Material: 8.2.14
  • Browser(s): Chrome (84.0.4147.105)
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

image

harshadray avatar Aug 07 '20 05:08 harshadray

What I find odd here is that it even breaks into multiple lines for the button and span cases, because I wouldn't have expected it to since we only support plain text for tooltips. My guess is that Angular automatically converts the HTML entities into new line characters and it just happens to work.

crisbeto avatar Aug 09 '20 08:08 crisbeto

Well, I have added class at global level to break it on next line. But as I mentioned, same is not working for mat-cell.

.mat-tooltip-class-here {
  white-space: pre-line !important;
}

harshadray avatar Aug 10 '20 11:08 harshadray

There is inconsistency in terms of new line chars.

For the button and span 
 works as new line but for the table cell, we might need to use \r\n or \n.

harshadray avatar Aug 14 '20 09:08 harshadray

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.