cypress_test/integration_tests/common/helper.js | 4 ++-- cypress_test/integration_tests/mobile/writer/focus_spec.js | 2 +- loleaflet/src/control/Control.LokDialog.js | 3 +-- loleaflet/src/control/Control.Toolbar.js | 2 +- loleaflet/src/layer/marker/TextInput.js | 2 +- loleaflet/src/map/Map.js | 8 +++++--- 6 files changed, 11 insertions(+), 10 deletions(-)
New commits: commit 769d4c7e1f742bc9d39516b1f5fd979468ba56cd Author: Ashod Nakashian <[email protected]> AuthorDate: Tue Mar 24 17:14:31 2020 -0400 Commit: Andras Timar <[email protected]> CommitDate: Thu Mar 26 17:57:27 2020 +0100 leaflet: give editor focus when closing sidebar And remove ineffective focus on closing sidebar. Change-Id: Iac6d46c91ca70949c73cd8cdb29416ecb80be409 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91017 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91129 diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index a58766c21..67387016a 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -1162,7 +1162,7 @@ L.Control.LokDialog = L.Control.extend({ } $('#sidebar-dock-wrapper').css({display: ''}); - if (this._map.editorHasFocus()) { + if (!this._map.editorHasFocus()) { this._map.fire('editorgotfocus'); this._map.focus(); } @@ -1218,7 +1218,6 @@ L.Control.LokDialog = L.Control.extend({ this._onSidebarClose(dialogId); } } - $('#sidebar-dock-wrapper').css({display: ''}); }, _onEditorGotFocus: function() { commit b22c49c555e99f20c377164265b215f57dabbedf Author: Ashod Nakashian <[email protected]> AuthorDate: Tue Mar 24 19:08:35 2020 -0400 Commit: Andras Timar <[email protected]> CommitDate: Thu Mar 26 17:57:15 2020 +0100 leaflet: shouldAcceptInput -> canAcceptKeyboardInput Clearer name to differentiate intent from expectation. Change-Id: I74cc4c3bca11782bdd9cf72d6af4534357cefa64 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91016 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91128 Tested-by: Andras Timar <[email protected]> diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 402432bc8..5f9eabdac 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -63,7 +63,7 @@ function enableEditingMobile() { // Assert that NO keyboard input is accepted (i.e. keyboard should be HIDDEN). function assertNoKeyboardInput() { cy.window().then(win => { - var acceptInput = win.shouldAcceptInput(); + var acceptInput = win.canAcceptKeyboardInput(); expect(acceptInput, 'Should accept input').to.equal(false); }); } @@ -71,7 +71,7 @@ function assertNoKeyboardInput() { // Assert that keyboard input is accepted (i.e. keyboard should be VISIBLE). function assertHaveKeyboardInput() { cy.window().then(win => { - var acceptInput = win.shouldAcceptInput(); + var acceptInput = win.canAcceptKeyboardInput(); expect(acceptInput, 'Should accept input').to.equal(true); }); } diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js index 49fbeae8b..970da0972 100644 --- a/cypress_test/integration_tests/mobile/writer/focus_spec.js +++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js @@ -200,7 +200,7 @@ describe('Focus tests', function() { // .should('be.eq', 'clipboard'); cy.window().then(win => { - expect(win.shouldAcceptInput(), 'Should accept input').to.equal(true); + expect(win.canAcceptKeyboardInput(), 'Should accept input').to.equal(true); }); }); diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index d6e8ce67d..5a44c8482 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -153,7 +153,7 @@ function onClick(e, id, item, subItem) { // In the iOS app we don't want clicking on the toolbar to pop up the keyboard. if (!window.ThisIsTheiOSApp && id !== 'zoomin' && id !== 'zoomout' && id !== 'mobile_wizard' && id !== 'insertion_mobile_wizard') { - map.focus(map.shouldAcceptInput()); // Maintain same keyboard state. + map.focus(map.canAcceptKeyboardInput()); // Maintain same keyboard state. } if (item.disabled) { diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js index 0495e077c..046a5d808 100644 --- a/loleaflet/src/layer/marker/TextInput.js +++ b/loleaflet/src/layer/marker/TextInput.js @@ -189,7 +189,7 @@ L.TextInput = L.Layer.extend({ // Returns true if the last focus was to accept input. // Used to restore the keyboard. - shouldAcceptInput: function() { + canAcceptKeyboardInput: function() { return this._acceptInput; }, diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index cc683de13..f8522d1b8 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -333,7 +333,7 @@ L.Map = L.Evented.extend({ // There is no way track the keyboard state // programmatically, so the next best thing // is to track what we intended to do. - window.shouldAcceptInput = function() { return map.shouldAcceptInput(); }; + window.canAcceptKeyboardInput = function() { return map.canAcceptKeyboardInput(); }; // This is used to extract the text we *intended* // to put on the clipboard. There is currently @@ -970,8 +970,10 @@ L.Map = L.Evented.extend({ return document.activeElement === this._textInput.activeElement(); }, - shouldAcceptInput: function() { - return this._textInput.shouldAcceptInput(); + // Returns true iff the textarea is enabled and we focused on it. + // On mobile, this signifies that the keyboard should be visible. + canAcceptKeyboardInput: function() { + return this._textInput.canAcceptKeyboardInput(); }, setHelpTarget: function(page) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
