Declined
Last Updated: 08 Apr 2020 16:26 by ADMIN
René
Created on: 08 Apr 2020 11:10
Category: Tooltip
Type: Bug Report
1
Tooltip ignores Newlines
The tooltip ignores newlines.  I tried "\n" and "\n\r" and "<br>" and "<br\>" but neither works.
2 comments
ADMIN
Marin Bratanov
Posted on: 08 Apr 2020 16:26

Hi RenĂ©, 

The TelerikTooltip component takes the string as-is from the title attribute. This means that the rendering context of that string is now HTML so \n and \r type of symbols won't render anything, you'd need a tag (like <br />) to render a new line.

In Blazor, however, to render HTML, you must use a MarkupString. We do not do that because that could be a potential security (XSS) attack vector.

If you need such complexity, I recommend using a template where you can prepare the desired content - create a MarkupString, ensure there are no scripts to be executed, transform \n \r characters to <br /> tags, anything else you need. Here's a basic example: https://docs.telerik.com/blazor-ui/components/tooltip/template#markup-from-generated-string

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
René
Posted on: 08 Apr 2020 11:11

"\n" and "\n\r"are filtered out of the string.

"<br>" and "<br\>" are displayed as part of the string.