From 4f624b70fcb1502aa18167fecfc5efe53f40ce75 Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Wed, 26 Sep 2018 15:06:52 +0200 Subject: [PATCH] [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. --- addons/web/static/src/js/core/dialog.js | 6 +++--- 1 file 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; },