Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use html content in <umb-confirm-modal> #18272

Closed
kraftvaerk-chth opened this issue Feb 10, 2025 · 4 comments
Closed

Unable to use html content in <umb-confirm-modal> #18272

kraftvaerk-chth opened this issue Feb 10, 2025 · 4 comments

Comments

@kraftvaerk-chth
Copy link

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

15.2.0

Bug summary

After upgrading from 15.0 to 15.2, it is no longer possible for us to display html content in the modal body
Not entirely sure why, but I believe it is related to the following changes:

Before:

override render() {
  return html`
    <uui-dialog-layout class="uui-text" .headline=${this.data?.headline || null}>
    ${this.data?.content}

After:

override render() {
  return html`
    <uui-dialog-layout class="uui-text" .headline=${this.localize.string(this.data?.headline) ?? null}>
    ${unsafeHTML(this.localize.string(this.data?.content))}

Specifics

No response

Steps to reproduce

Use umbraco 15.2

Create an extension for the backoffice in any way you like, for example a context that is instantiated always with no conditions
Trigger a confirm modal with the following code:

umbConfirmModal(host, {
  content: html`<p>dummy text</p>`,
  headline: "headline",
  confirmLabel: "Gem kladde",
  cancelLabel: "Kassér ændringer",
})

The modal will have an empty body, not displaying the dummy html

now try changing the content to be a plain string, rather than a lit html template:

content: "dummy text"

The modal will now display the text

Expected result / actual result

Expected:
Modal should display the html content

Actual:
Modal does not display html, only works with plain strings

Copy link

Hi there @kraftvaerk-chth!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@iOvergaard
Copy link
Contributor

Hello @kraftvaerk-chth and thanks for the report. While I agree this is a regression, I wonder if it would work simply by passing in a raw HTML string like content: '<p>dummy text</p>' as it is rendered out through the unsafeHTML directive?

@nielslyngsoe
Copy link
Member

Hi @kraftvaerk-chth

Wether Jacobs idea works or not, you are ofcourse right that this is a regression — especially because the UmbConfirmModal accepts content as TemplateResult aka. Lit-HTML.

So here comes a fix, targeted for v.15.3.
#18300

madsrasmussen pushed a commit that referenced this issue Feb 12, 2025
* only localize if string

* better types of localize string

* test for string update
@madsrasmussen
Copy link
Contributor

Fixed by #18300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants