Am I crazy, or did a BUNCH of stuff stop rendering the HTML inside of passed strings?

2 Answers 50 Views
Switch
Josh
Top achievements
Rank 1
Iron
Josh asked on 21 Nov 2024, 08:47 PM | edited on 21 Nov 2024, 09:13 PM

(edit: I didn't initially realize this was being posted in the UI for jQuery forum and have since duplicated in the .net core forum - feel free to remove this one if deemed inappropriate for this forum)

I'm just starting to catalog the issues list, but I'm immediately noticing that any markup passed to non-template areas has ceased rendering.

For example:


<div class="demo-section">
    @(Html.Kendo().Switch()
                .Name("switch")
                .Messages(c => c.Checked("<span>YES</span>").Unchecked("<span>NO</span>"))
    )
</div>

used to render the markup vs displaying the markup text. Now it spits it out.

I have used similar techniques in Grid commands as well, which are all also broken. Basic custom commands I can work around by using the .Template option instead of .Text, but for an Edit's UpdateText and CancelText, I cannot find a workaround that isn't completely unbearable to manage at anything remotely near scale.

Is there a workaround or option to re-enable rendering HTML in these places I am simply not seeing? 

Also, this feels like a pretty significant change to bury inside of a generic "rendering mismatch" (which may not even be referring to this, but I cannot find anything in the breaking changes mentioning something like this change). If there's not an effective way to get back to this functionality, it's going to potentially cost me days/weeks to find a tenable solution.

2 Answers, 1 is accepted

Sort by
0
Accepted
Josh
Top achievements
Rank 1
Iron
answered on 27 Nov 2024, 04:30 PM | edited on 27 Nov 2024, 04:31 PM

Re: Switch use of html inside messages - it's gone

Re: Grid use for the edit command's save/cancel options - I was able to leverage the icon classes to achieve an acceptable solution for my needs, which is applicable to both my .net core uses as well as my dynamically created jquery use cases.

0
Mihaela
Telerik team
answered on 26 Nov 2024, 04:20 PM

Hello Josh,

Thank you for reaching out.

Generally, the Messages() configurations of the Switch component, as well as for all other components, expect a string that is used for localizing the respectful label, attribute, etc. This should be plain text rather than HTML. Those message options are normally encoded and in this particular case we have identified a location where we have missed encoding the passed value, thus the change (it is introduced in version 2024.3.806).

Having this in mind, you can still customize the checked/unchecked messages with CSS, as per the example below:

<div class="demo-section">
    @(Html.Kendo().Switch()
                .Name("switch")
                .Messages(c => c.Checked("YES").Unchecked("NO"))
    )
</div>

<style>
.k-switch .k-switch-label-off {
    color: red;
}

.k-switch .k-switch-label-on {
    color: black;
}
</style>

Regarding the Grid, please share more details in what must be the label of the "Update" button, and I will share the respective suggestion.

Regards,
Mihaela
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Josh
Top achievements
Rank 1
Iron
commented on 27 Nov 2024, 04:27 PM

Thanks Mihaela - I was able to find a workable solution for my grid needs (I outlined on my .net core version of this post and I believe you just commented on as well) and just will accept the limitations of the Switch as text (and style) only. I was hoping to continue using 3rd party iconography in the switch messages, but it is not a deal-breaker.
Mihaela
Telerik team
commented on 28 Nov 2024, 02:33 PM

Thank you for your update, Josh.

If any additional questions arise, don't hesitate to share them. I would be happy to help you.

Best,
Mihaela

Tags
Switch
Asked by
Josh
Top achievements
Rank 1
Iron
Answers by
Josh
Top achievements
Rank 1
Iron
Mihaela
Telerik team
Share this question
or