[Libreoffice-commits] online.git: loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 20 15:13:05 UTC 2019


 loleaflet/src/control/Control.MobileWizard.js |    5 +++++
 loleaflet/src/map/Map.js                      |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 6142bf5ad34597ee8be9d3a786a6e30f9c5f3179
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Nov 20 08:46:55 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Wed Nov 20 16:12:45 2019 +0100

    mobilewizard: restore document focus when mobile wizard is hidden
    
    The "activeElement" returns the current element that has the focus,
    so when the mobile wizard is hidden ensure the document gets focus back.
    
    Change-Id: Id801a9995a31766441f445e7c1180c1672cf8adf
    Reviewed-on: https://gerrit.libreoffice.org/83306
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 5dd43ed9b..d8ff8a61a 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -61,6 +61,7 @@ L.Control.MobileWizard = L.Control.extend({
 		if (this.map._permission === 'edit') {
 			$('#toolbar-down').show();
 		}
+
 		this._isActive = false;
 		this._currentPath = [];
 		if (window.mobileWizard === true) {
@@ -70,6 +71,10 @@ L.Control.MobileWizard = L.Control.extend({
 			this.map.sendUnoCommand('.uno:Sidebar');
 			window.mobileWizard = false;
 		}
+
+		if (!this.map.hasFocus()) {
+			this.map.focus();
+		}
 	},
 
 	_hideKeyboard: function() {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 0852fa0ef..9db28ab4c 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -904,7 +904,7 @@ L.Map = L.Evented.extend({
 	},
 
 	hasFocus: function () {
-		return this._textInput.hasFocus();
+		return document.activeElement === this._textInput.activeElement();
 	},
 
 	setHelpTarget: function(page) {


More information about the Libreoffice-commits mailing list