Minor UX improvement
authorAlexander Ebert <ebert@woltlab.com>
Wed, 14 Sep 2016 17:04:25 +0000 (19:04 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 14 Sep 2016 17:04:25 +0000 (19:04 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js

index 03f85d908170080ebb147753a529df6183787a16..73354b3d4d31b1094f3937a2a4ef5c66fe028afb 100644 (file)
@@ -164,7 +164,12 @@ $.Redactor.prototype.WoltLabButton = function() {
                        _toggleButton.children[0].addEventListener('mousedown', (function (event) {
                                event.preventDefault();
                                
-                               this.$toolbar[0].classList.toggle('redactorToolbarOverride');
+                               if (this.$toolbar[0].classList.toggle('redactorToolbarOverride')) {
+                                       // this prevents mobile browser from refocusing another element
+                                       if (document.activeElement && document.activeElement !== this.$editor[0]) {
+                                               document.activeElement.blur();
+                                       }
+                               }
                                
                                icon.classList.toggle('fa-caret-down');
                                icon.classList.toggle('fa-caret-up');