Dnn.Platform
Dnn.Platform copied to clipboard
Parameter showReturn of dnnModal.show() not working but it is essential on mobile devices
Description of bug
dnnModal.show(), a JavaScript method that allows to load up any URL in a popup window, has a parameter called showReturn (the second one) that is intended for showing a Return button at the bottom of the popup. Regardless the value assigned to this parameter (true or false) the return button is never shown.
Usually popup windows are closed by using the close button on the popup windows themself (the one with the X in it, just to be clear). However on mobile devices, popup windows differ from the ones opened on desktops in that they have no minimize, maximize, restore and close buttons. Therefore, there is no mean for the user to close a popup window opened by the dnnModal.show() unless by reloading the page via the browser button.
Steps to reproduce
To reproduce this bug just make the following call: javascript:dnnModal.show('ANY_URL?popUp=true',true,550,800,false);
Current behavior
Even if the showReturn button is set to true, a Return button is not shown.
Expected behavior
If showReturn is true, a button to exit the popup windows should appear at the bottom of the popup window, thus allowing the user to exit it by clicking the Return button.
Screenshots

it should be like this instead

Error information
No error is displayed in console or error log.
Additional context
The dnn.modalpopup.js uses the dialog widget of the jquery-ui.js. To make buttons appear , the options shoud include a buttons parameter. Instead the showReturn is passed at it is to the dialog widget even if it doesn't support that parameter. It would suffice to add a similar code (assuming the label of the return button is OK) prior to calling the dialog widget constructor:
var showReturnButtons = [];
if (showReturn.toString() === "true") {
showReturnButtons = [
{
text: "OK",
icon: "ui-icon-heart",
click: function() {
$( this ).dialog( "close" );
}
}
];
}
and then in the dialog widget constructor replace showReturn: showReturn with buttons: showReturnButtons like this:
```
$modal.dialog({ modal: true, autoOpen: true, dialogClass: "dnnFormPopup", position: { my: "center", at: "center" }, minWidth: width, minHeight: height, maxWidth: 1920, maxHeight: 1080, resizable: true, closeOnEscape: true, refresh: refresh, buttons: showReturnButtons, closingUrl: closingUrl, open: dialogOpened, close: function() { window.dnnModal.closePopUp(refresh, closingUrl); } })
## Affected version
* [X] 10.00.00 alpha build
* [X] 09.11.02 release candidate
* [X] 09.11.01 latest supported release
## Affected browser
* [X] Chrome
* [X] Firefox
* [X] Safari
* [X ] Internet Explorer 11
* [X] Microsoft Edge (Classic)
* [X] Microsoft Edge Chromium
I confirm this is a bug also occuring on DNN 9.11.2