summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Reeves2016-08-12 00:35:34 (GMT)
committerScott Reeves2016-08-12 00:35:34 (GMT)
commit1aa645839b75291e3dde674f14dc9aa9f5e606c7 (patch)
treee54cf08133671ab2bed8056000e0e393fb74828d
parent8824b86716d412d542648e1f6e17906e545a5748 (diff)
Issue #2640464 by samuel.mortenson, Chernous_dn, droplet, Wim Leers: Links styled as buttons not placed inside Dialog's button pane — prevents "cancel" link/button from showing up
-rw-r--r--core/misc/dialog/dialog.ajax.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/misc/dialog/dialog.ajax.js b/core/misc/dialog/dialog.ajax.js
index 16f72f0..3f1b0c2 100644
--- a/core/misc/dialog/dialog.ajax.js
+++ b/core/misc/dialog/dialog.ajax.js
@@ -62,7 +62,7 @@
*/
prepareDialogButtons: function ($dialog) {
var buttons = [];
- var $buttons = $dialog.find('.form-actions input[type=submit]');
+ var $buttons = $dialog.find('.form-actions input[type=submit], .form-actions a.button');
$buttons.each(function () {
// Hidden form buttons need special attention. For browser consistency,
// the button needs to be "visible" in order to have the enter key fire
@@ -74,14 +74,22 @@
width: 0,
height: 0,
padding: 0,
- border: 0
+ border: 0,
+ overflow: 'hidden'
});
buttons.push({
text: $originalButton.html() || $originalButton.attr('value'),
class: $originalButton.attr('class'),
click: function (e) {
- $originalButton.trigger('mousedown').trigger('mouseup').trigger('click');
- e.preventDefault();
+ // If the original button is an anchor tag, triggering the "click"
+ // event will not simulate a click. Use the click method instead.
+ if ($originalButton.is('a')) {
+ $originalButton[0].click();
+ }
+ else {
+ $originalButton.trigger('mousedown').trigger('mouseup').trigger('click');
+ e.preventDefault();
+ }
}
});
});