Skip to content

Umlaut not displayed correctly in VEX alert of repeater trash feature #2063

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

Open
BernhardBaumrock opened this issue Apr 15, 2025 · 11 comments
Open

Comments

@BernhardBaumrock
Copy link

BernhardBaumrock commented Apr 15, 2025

This is what I see when double-clicking the trash icon of a repeater item:

Image

The only related issue that I found is this: #117

I also asked Jens whether this is an issue with his german translation or a core issue. He said it's a core issue, so here we are ;)

@matjazpotocnik
Copy link
Collaborator

Isn't this related? #2019

@BernhardBaumrock
Copy link
Author

@matjazpotocnik absolutely! Thx for the reference. I knew I posted it but I couldn't find it any more :)

@BernhardBaumrock
Copy link
Author

Seems to me that all of those are related to VEX popups?

@ryancramerdesign
Copy link
Member

@BernhardBaumrock I did some testing and the issue appears to be in Vex. Even just a & gets converted to &. I tried to debug it directly in Vex but wasn't successful. Vex doesn't appear to be maintained anymore, so wondering if maybe we should switch to a different library for handing alert, confirm and prompt boxes.

@BernhardBaumrock
Copy link
Author

Wow, what a bummer. Thx for looking into it Ryan!

What about going with UIkit's native alerts then? https://getuikit.com/docs/modal#modal-dialogs

I think I had some trouble with the confirmation dialog api but I can't remember exactly - or maybe they changed it in an update as from the docs on first glance it looks fine. But I'm happy to help wherever I can with that.

And I'm a bit afraid of having to refactor some modules that rely on vex dialogs, but it should not be too hard I guess and if it's necessary, it's necessary...

@ryancramerdesign
Copy link
Member

@BernhardBaumrock I won't remove Vex, I'm just thinking of replacing what ProcessWire.alert() and ProcesssWire.confirm() use. Going the Uikit route sounds like a good idea, I'll look into it. The non-Uikit/legacy admin themes can just fallback to the standard JS alert and confirm boxes.

@BernhardBaumrock
Copy link
Author

Ah, I see, yeah that sounds like a good solution then :)

@matjazpotocnik
Copy link
Collaborator

@ryancramerdesign

if (options.unsafeMessage && !options.message) {
        options.message = options.unsafeMessage
      } else if (options.message) {
        options.message = vex._escapeHtml(options.message)
      }
// Use the DOM's HTML parsing to escape any dangerous strings
var escapeHtml = function escapeHtml (str) {
  if (typeof str !== 'undefined') {
    var div = document.createElement('div')
    div.appendChild(document.createTextNode(str))
    return div.innerHTML
  } else {
    return ''
  }

A quick fix fould be to return str instead of 'return div.innerHTML' or use ProcessWire.alert("&",true); (allowMarkup set to true, default is false). main.js, line 505, ProcessWire.alert function.

But I agree, vex is unmaintained for several years, there are many open issues regarding security, UX and accessibility and should be replaced. Maybe https://github.com/sweetalert2/sweetalert2 Or plain alert/message/prompt JavaScript boxes? They are not fancy but work, are accessible, and don't require third-party libraries. Even dialog can be used https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog

@teppokoivula
Copy link

teppokoivula commented Apr 18, 2025

Even dialog can be used https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog

Still using sweetalert2 in some cases (mostly because it comes with all the bells and whistles already baked in) but dialog is definitely the way to go for anything new :)

ryancramerdesign added a commit to processwire/processwire that referenced this issue Apr 18, 2025
…mpt() Javascript functions to use Uikit modals rather than Vex modals. This also should also help to solve processwire/processwire-issues#2063 ...also added ProcessWire.entities1() and ProcessWire.unentities() JS functions to mirror those in Sanitizer.
@ryancramerdesign
Copy link
Member

@BernhardBaumrock I've updated the alert, confirm and prompt functions to use Uikit modals rather than Vex modals, at least when Uikit is available. I'll look into native dialogs as well, but the Uikit ones were a good fit for now, as they work similarly to the Vex ones. Do you find that it fixes the issue?

@matjazpotocnik
Copy link
Collaborator

@ryancramerdesign,

typeof is missing when comparing funcOk and funcCancel with "undefined" in ProcessWire.confirm function, lines 531 and 533.

This line: @param bool Allow markup in confirm message? (default=false) should probably be @param allowMarkup Allow markup in confirm message? (default=false)?

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