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

Do not use native prompts #980

Open
Huji opened this issue Jun 17, 2020 · 6 comments
Open

Do not use native prompts #980

Huji opened this issue Jun 17, 2020 · 6 comments

Comments

@Huji
Copy link
Contributor

Huji commented Jun 17, 2020

Twinkle uses prompt() in a few places. The problem with this is prompt is not RTL-friendly. That is, the textbox it provides to the user to enter a response in is always left-to-right.

Instead of relying on native functions, Twinkle should create a dialog that is internationalizeable.

@Amorymeltzer Amorymeltzer added bug Other wikis non-EnWiki issues and language/i18n/l10n stuff labels Jun 19, 2020
@Amorymeltzer
Copy link
Collaborator

I wonder if something like jQuery UI's dialog would be helpful.

@Huji Huji changed the title Do not use native prompts Do not use native prompts, alerts or confirms Jun 19, 2020
@Huji Huji changed the title Do not use native prompts, alerts or confirms Do not use native prompts Jun 19, 2020
@siddharthvp
Copy link
Member

Isn't this something to be fixed in the browsers?

I wonder if something like jQuery UI's dialog would be helpful.

I don't think so, as jqueryUI doesn't blcok the event loop. OOUI has prompts that uses promises (resolved when the user submits), but then doing something like that would be a pretty big change on the codebase.

@Amorymeltzer
Copy link
Collaborator

Ahh, I thought some of the stopPropagation stuff would work, I'm not very familiar with it. I honestly think the OOUI stuff might be obsoleted by the vue stuff beforehand...

@ed6767
Copy link
Member

ed6767 commented Jul 4, 2020

The issue with replacing prompt() and alert() is that they both functions that suspend until user interaction, so they may be implemented with if statements and other inline things. Here, I would think OOUI is ideal, then partially restructuring every instance of alert, prompt, ext. using a callback instead, which could be fed into the same if statements - so instead of:

if (prompt("What's your name?") == "dave") {
    alert("Ayup Dave!");
} else {
    alert("Hello");
}
// And things to go after

It should be:

promptFunction("What's your name?", function(name){
    if (name== "dave") {
       alert("Ayup Dave!");
   } else {
       alert("Hello");
  }
});

This shouldn't require too much work past some copy-pasting and a rough restructuring.

I'm very happy to aid slowly transitioning to OOUI rather than jQueryUI and outdated Javascript functions such as prompt ext.

@Huji
Copy link
Contributor Author

Huji commented Jul 5, 2020

I believe there is a strong desire against using OOUI in Twinkle for two reasons; one is that OOUI doesn't allow its modal dialogs to be moved; the other is that OOUI uses lots of white space in its elements and with something like twinkle's speedy module that has tens of options, that may result in lots of scrolling.

@Amorymeltzer
Copy link
Collaborator

This is more for #414, but basically what @Huji said: windows won't move, poor use of space. The longer is answer is that it'd be a spectacularly massive undertaking. The even longer answer is that I'm not sure, and I think recent events have made clear, that while OOUI may be around for a while, it's not a long-term solution.

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