summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/dialog.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2018-09-26 15:06:52 +0200
committerVincent Schippefilt <vsc@odoo.com>2018-09-26 16:18:41 +0200
commit4f624b70fcb1502aa18167fecfc5efe53f40ce75 (patch)
tree21204891a1907cf4b603af5e6f49062579083c4c /addons/web/static/src/js/core/dialog.js
parentfe4c3e0064e01ec2ac34e629408979b1a9c9eb7c (diff)
[FIX] web: dialogs with shouldFocusButtons option have the focus set.
Before this fix, sometimes dialogs that had the option shouldFocusButtons set on open did not set the focus on the buttons. This is especially true for the "discard changes" dialog where it is less usable with the keyboard. After this fix, we wait for the widget to append itself to the dom before setting the focus.
Diffstat (limited to 'addons/web/static/src/js/core/dialog.js')
-rw-r--r--addons/web/static/src/js/core/dialog.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js
index 9fa42fb6e2b..492ea06c7bd 100644
--- a/addons/web/static/src/js/core/dialog.js
+++ b/addons/web/static/src/js/core/dialog.js
@@ -182,10 +182,10 @@ var Dialog = Widget.extend({
self.$modal.removeAttr("aria-hidden");
self.$modal.modal('show');
self._opened.resolve();
+ if (options && options.shouldFocusButtons) {
+ self._onFocusControlButton();
+ }
});
- if (options && options.shouldFocusButtons) {
- self._onFocusControlButton();
- }
return self;
},