Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24426] Remove "Alert" title from alert()

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2017-11-28T16:33:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.0.0
ComponentsAndroid, iOS, Windows
Labelsalert, android
ReporterMichael Gangolf
AssigneeChristopher Williams
Created2017-02-22T17:15:05.000+0000
Updated2017-11-28T16:33:15.000+0000

Description

The current alert() function will display a dialog box with a fixed "Alert" title. Since it is not really necessary to have this title and very confusing since you can't change or localize it it would be better to remove it and when you want to have a custom title you can create a custom AlertDialog. Test code:
Ti.UI.setBackgroundColor('white');
var win = Ti.UI.createWindow({
    title: 'Click window to test',
    backgroundColor: 'white',
    layout: "vertical"
});

win.addEventListener("open",function(){
    alert("Test");
})
win.open();
Current output: Alert dialog with title "Alert" and text "Test" Changed output: Alert dialog with just the text "Test"

Attachments

FileDateSize
Screen Shot 2017-11-27 at 1.35.36 PM.png2017-11-27T18:37:53.000+00007238
Screen Shot 2017-11-27 at 1.36.03 PM.png2017-11-27T18:37:55.000+000014302

Comments

  1. Michael Gangolf 2017-02-22

    PR: https://github.com/appcelerator/titanium_mobile/pull/8846 if someone can create the iOS part it would be awesome!
  2. Sharif AbuDarda 2017-02-22

    Hello, You can customize the title by defining title property and a value in string to show as the title of the alert dialog. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.AlertDialog-property-title. Now, if you want to completely remove the alert section from alert dialog (only the message and button), we need sufficient guide link if this is available naively. Thanks.
  3. Michael Gangolf 2017-02-22

    I know about the AlertDialog title, which is the workaround I was talking about. I'm adressing the "Global Alias" mentioned on that page that will generate This will generate an alert with a title of "Alert" and an "OK" button. and you can't customize it. In a German app you still have "Alert" as a title and if you want to customize it you have to create an AlertDialog so it is not useful. And for quick outputs it would be useful to just write alert(txt) instead of creating an own dialog. When you create a native AlertDialog you can specify the title and if you don't do it it will be blank: https://www.tutorialspoint.com/android/images/alert_dialog.jpg As you can see in the PR: https://github.com/appcelerator/titanium_mobile/pull/8846/files#diff-b400c1d8abc31b691b4e5dbcac4b3d43L230 the title "Alert" is just set in the code and doesn't come from the native app
  4. Sharif AbuDarda 2017-02-23

    Hello, Thanks for your PR. Our engineers will consider the request.
  5. Hans Knöchel 2017-02-24

    The alert method is supposed to reflect the JS alert web-method. If that one doesn't use the "Alert" title, that's fine. Otherwise, we need to reject this PR. Please check with a german and english locale and compare the browser alerts.
  6. Michael Gangolf 2017-02-24

    At least on Firefox (Linux) it looks like this: !http://www.migaweb.de/alert.jpg!
  7. Christopher Williams 2017-11-27

    On macOS in Safari and Chrome the popup dialog has no "chrome" to it, so there's no real title. There's basically just the message and an ok link on Safari, and on Chrome it precedes the message with the URL. !Screen Shot 2017-11-27 at 1.35.36 PM.png|thumbnail! !Screen Shot 2017-11-27 at 1.36.03 PM.png|thumbnail!

JSON Source