[TIMOB-24426] Remove "Alert" title from alert()
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-11-28T16:33:09.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.0.0 |
Components | Android, iOS, Windows |
Labels | alert, android |
Reporter | Michael Gangolf |
Assignee | Christopher Williams |
Created | 2017-02-22T17:15:05.000+0000 |
Updated | 2017-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
File | Date | Size |
---|---|---|
Screen Shot 2017-11-27 at 1.35.36 PM.png | 2017-11-27T18:37:53.000+0000 | 7238 |
Screen Shot 2017-11-27 at 1.36.03 PM.png | 2017-11-27T18:37:55.000+0000 | 14302 |
PR: https://github.com/appcelerator/titanium_mobile/pull/8846 if someone can create the iOS part it would be awesome!
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.
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 appHello, Thanks for your PR. Our engineers will consider the request.
The
alert
method is supposed to reflect the JSalert
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.At least on Firefox (Linux) it looks like this: !http://www.migaweb.de/alert.jpg!
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!