From 8f38e83aaf0991162b795b8f4c1d66a01ded5bcf Mon Sep 17 00:00:00 2001 From: Antony Male Date: Wed, 15 Jul 2015 12:20:27 +0100 Subject: [PATCH] Allow #editIgnores to scroll in browser (fixes #2041) class modal-open is applied to , which ultimately means that the browser will scoll to the modal's content. However, #editFolder was finishing its close animation (and removing this modal-open class) after #editIgnores had set modal-open (and had started its open animation). The end result is that ends up without modal-open when #editIgnores is open, and so the browser doesn't properly scroll. Instead, only open the #editIgnores once #editFolder has finished closing. --- .../core/controllers/syncthingController.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gui/scripts/syncthing/core/controllers/syncthingController.js b/gui/scripts/syncthing/core/controllers/syncthingController.js index d20fec4b0..1f8dbebd9 100755 --- a/gui/scripts/syncthing/core/controllers/syncthingController.js +++ b/gui/scripts/syncthing/core/controllers/syncthingController.js @@ -1230,17 +1230,19 @@ angular.module('syncthing.core') .success(function (data) { data.ignore = data.ignore || []; - $('#editFolder').modal('hide'); - var textArea = $('#editIgnores textarea'); + $('#editFolder').modal('hide') + .one('hidden.bs.modal', function() { + var textArea = $('#editIgnores textarea'); - textArea.val(data.ignore.join('\n')); + textArea.val(data.ignore.join('\n')); - $('#editIgnores').modal() - .on('hidden.bs.modal', function () { - $('#editFolder').modal(); - }) - .on('shown.bs.modal', function () { - textArea.focus(); + $('#editIgnores').modal() + .one('hidden.bs.modal', function () { + $('#editFolder').modal(); + }) + .one('shown.bs.modal', function () { + textArea.focus(); + }); }); }) .then(function () {