{"action":"opened","issue":{"url":"https://api.github.com/repos/bootstrap-wysiwyg/bootstrap3-wysiwyg/issues/172","repository_url":"https://api.github.com/repos/bootstrap-wysiwyg/bootstrap3-wysiwyg","labels_url":"https://api.github.com/repos/bootstrap-wysiwyg/bootstrap3-wysiwyg/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/bootstrap-wysiwyg/bootstrap3-wysiwyg/issues/172/comments","events_url":"https://api.github.com/repos/bootstrap-wysiwyg/bootstrap3-wysiwyg/issues/172/events","html_url":"https://github.com/bootstrap-wysiwyg/bootstrap3-wysiwyg/issues/172","id":139649169,"number":172,"title":"Infinite Focus Loop in Internet Explorer 11","user":{"login":"Sephster","id":1457058,"avatar_url":"https://avatars.githubusercontent.com/u/1457058?v=3","gravatar_id":"","url":"https://api.github.com/users/Sephster","html_url":"https://github.com/Sephster","followers_url":"https://api.github.com/users/Sephster/followers","following_url":"https://api.github.com/users/Sephster/following{/other_user}","gists_url":"https://api.github.com/users/Sephster/gists{/gist_id}","starred_url":"https://api.github.com/users/Sephster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sephster/subscriptions","organizations_url":"https://api.github.com/users/Sephster/orgs","repos_url":"https://api.github.com/users/Sephster/repos","events_url":"https://api.github.com/users/Sephster/events{/privacy}","received_events_url":"https://api.github.com/users/Sephster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-09T17:37:09Z","updated_at":"2016-03-09T17:37:09Z","closed_at":null,"body":"If you open two windows for IE11 and both have tabs containing pages with the Bootstrap3-wysiwyg editor, you can trigger an infinite focus loop in JavaScript.\r\n\r\n## Steps to recreate:\r\n\r\n* Open 2 IE11 windows\r\n* In each window, load a tab containing a page with the wysiwyg editor. In my case I just loaded the * same page twice\r\n* Click in one or two text areas and scroll up and down in window A. Repeat steps in window A and alternate between the two until the bug appears.\r\n\r\nThe bug manifests itself by continually focussing on a text area. This forces the text cursor to be positioned at the start of the text area and prevents scrolling up and down the page as the focus call makes the browser jump back to the text area.\r\n\r\nFrom my tests it seems this is the offending piece of code:\r\n\r\n```\r\n#!javascript\r\n\r\n // --------- IE 8+9 focus the editor when the iframe is clicked (without actually firing the 'focus' event on the <body>) ---------\r\n    if (!this.config.contentEditableMode && browser.hasIframeFocusIssue()) {\r\n      dom.observe(container, \"focus\", function() {\r\n        setTimeout(function() {\r\n          if (that.doc.querySelector(\":focus\") !== that.element) {\r\n            that.focus();\r\n          }\r\n        }, 0);\r\n      });\r\n\r\n      dom.observe(this.element, \"blur\", function() {\r\n        setTimeout(function() {\r\n          that.selection.getSelection().removeAllRanges();\r\n        }, 0);\r\n      });\r\n    }\r\n```\r\n\r\nI fixed it in my site by doing the following although I'm unsure that this is a robust solution:\r\n\r\n```\r\n!#javascript\r\n/**\r\n     * IE 8+9 don't fire the focus event of the <body> when the iframe gets focused (even though the caret gets set into the <body>)\r\n     */\r\n    hasIframeFocusIssue: function() {\r\n      return isIE(10, \">\");\r\n    }\r\n```\r\n\r\nAny help would be much appreciated"}}