changeset 0ccf80b0aead in sao:5.2
details: https://hg.tryton.org/sao?cmd=changeset;node=0ccf80b0aead
description:
        Set focus on the form if it does not have it

        When set_cursor is called, it should force to set the focus on the first
        focusable widget of the form.

        issue8604
        review258011002
        (grafted from d8401a59de642e154d99c4f48c04bc29e9a44f28)
diffstat:

 src/view/form.js |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff -r bffee0edee06 -r 0ccf80b0aead src/view/form.js
--- a/src/view/form.js  Mon Sep 02 18:31:43 2019 +0200
+++ b/src/view/form.js  Mon Sep 02 18:33:18 2019 +0200
@@ -334,8 +334,8 @@
             var widgets, error_el, pages, is_ancestor;
 
             var currently_focused = jQuery(document.activeElement);
-            var has_focus = currently_focused.closest(this.el) > 0;
-            if (reset_view || has_focus) {
+            var has_focus = currently_focused.closest(this.el).length > 0;
+            if (reset_view || !has_focus) {
                 if (reset_view) {
                     for (i = 0; i < this.notebooks.length; i++) {
                         notebook = this.notebooks[i];

Reply via email to