Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The browser platform, reflecting the limitations of window.confirm() and window.prompt(), doesn't allow customization of the button labels. That's fine.
However, it blithely triggers the callback with hardcoded button values of 1 for OK and 2 for Cancel. That's dangerous, because the developer may have assigned different labels for those buttons.
For example, if the developer reverses the order of the Cancel and OK buttons (and therefore interprets the button index differently in the callback), the browser platform version will end up calling the OK callback when the user presses Cancel, which could lead to data loss and other serious problems.
One solution would be to document the limitations of the browser platform, and then fail fast (i.e. refuse to show the dialog) if the caller tries to pass custom button labels.