[Libreoffice-commits] online.git: 2 commits - cypress_test/integration_tests loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 25 11:29:33 UTC 2020
cypress_test/integration_tests/common/helper.js | 6 ++
cypress_test/integration_tests/mobile/calc/focus_spec.js | 31 +++++++++++++++
loleaflet/src/control/Control.MobileWizard.js | 7 ++-
loleaflet/src/layer/tile/TileLayer.js | 20 ++++-----
loleaflet/src/map/Map.js | 10 ++--
5 files changed, 57 insertions(+), 17 deletions(-)
New commits:
commit 30f9f7bfdcc3e0c53df50132c8283a1d161d9f7f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Mar 24 18:30:06 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 25 12:29:25 2020 +0100
leaflet: allow keyboard with Calc MobileWizard
This is to facilitate searching for a formula,
which is shown as a list via the Mobile Wizard.
Change-Id: If4ae2dfbce1c9cf153354d1c3a2ff7a8f4af3ea2
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91020
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index e18b8ccdf..1f10b1a60 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -317,7 +317,12 @@ L.Control.MobileWizard = L.Control.extend({
else mWizardContentLength = data.children[0].children.length;
this._showWizard(mWizardContentLength);
- this._hideKeyboard();
+ if (!this._map._docLayer.isCalc()) {
+ // In Calc, the wizard is used for the formulas,
+ // and it's easier to allow the user to search
+ // for a formula by typing the first few characters.
+ this._hideKeyboard();
+ }
// Morph the sidebar into something prettier
if (isSidebar)
commit e9157a886f5a915ae36cec2bcfcb8472c785624b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Mar 24 12:15:51 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 25 12:29:14 2020 +0100
leaflet: don't allow focus stealing
This improves typing in the formula-bar.
Change-Id: I14359b5b4e842b68b1807d286e1831b3805bb4ea
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91019
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 31c2a34fc..d5f110056 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -80,6 +80,10 @@ function assertHaveKeyboardInput() {
function assertCursorAndFocus() {
cy.log('Verifying Cursor and Focus.');
+ // Active element must be the textarea named clipboard.
+ cy.document().its('activeElement.className')
+ .should('be.eq', 'clipboard');
+
// In edit mode, we should have the blinking cursor.
cy.get('.leaflet-cursor.blinking-cursor')
.should('exist');
@@ -122,7 +126,7 @@ function clearAllText() {
// clipboard (which Cypress doesn't support).
// Takes a closure f that takes the text
// string as argument. Use as follows:
-// helper.getTextForClipboard((htmlText, plainText) => {
+// helper.getTextForClipboard((plainText) => {
// expect(plainText, 'Selection Text').to.equal(testText);
// });
function getTextForClipboard(f) {
diff --git a/cypress_test/integration_tests/mobile/calc/focus_spec.js b/cypress_test/integration_tests/mobile/calc/focus_spec.js
index 9b375db34..481d61165 100644
--- a/cypress_test/integration_tests/mobile/calc/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/focus_spec.js
@@ -70,4 +70,35 @@ describe('Calc focus tests', function() {
cy.document().its('activeElement.className')
.should('be.eq', 'clipboard');
});
+
+ it('Formula-bar focus', function() {
+ // Click on edit button
+ helper.enableEditingMobile();
+
+ // Body has the focus -> can't type in the document
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY');
+
+ helper.assertNoKeyboardInput();
+
+ // One tap on a cell -> no document focus
+ calcHelper.clickOnFirstCell();
+
+ cy.get('.leaflet-marker-icon')
+ .should('be.visible');
+
+ // No focus
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY');
+
+ // Click in the formula-bar.
+ cy.get('.inputbar_container')
+ .click();
+
+ helper.assertCursorAndFocus();
+
+ // Type some text.
+ cy.get('textarea.clipboard')
+ .type('blah');
+ });
});
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 46b3a4612..ba321a18e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1171,7 +1171,7 @@ L.TileLayer = L.GridLayer.extend({
this._showURLPopUp(cursorPos, obj.hyperlink.link);
}
- if (!this._map.editorHasFocus() && (modifierViewId === this._viewId) && (this._map._permission === 'edit')) {
+ if (!this._map.editorHasFocus() && this._map._isCursorVisible && (modifierViewId === this._viewId) && (this._map._permission === 'edit')) {
// Regain cursor if we had been out of focus and now have input.
// (only if it is our own cursor and the input is actually not
// going into a dialog)
@@ -2188,20 +2188,18 @@ L.TileLayer = L.GridLayer.extend({
this._updateCursorPos();
- // Update the cursor/keyboard only when the document has focus.
- if (this._map.editorHasFocus()) {
- this._map._textInput.showCursor();
+ this._map._textInput.showCursor();
- // Don't show the keyboard when the Wizard is visible.
- if (!window.mobileWizard) {
- // If the user is editing, show the keyboard, but don't change
- // anything if nothing is changed.
- this._map.focus(true);
- }
+ // Don't show the keyboard when the Wizard is visible.
+ if (!window.mobileWizard) {
+ // If the user is editing, show the keyboard, but don't change
+ // anything if nothing is changed.
+ this._map.focus(true);
}
} else {
this._map._textInput.hideCursor();
- this._map.focus(false);
+ if (this._map.editorHasFocus()) // Allow input if a dialog has the focus.
+ this._map.focus(false);
}
},
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 024192295..38f0803dc 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1408,12 +1408,14 @@ L.Map = L.Evented.extend({
this._activeDialog = dialog;
this._isSearching = false;
- var doclayer = this._docLayer;
- if (doclayer)
+ if (this.editorHasFocus()) {
+ // The document has the focus.
+ var doclayer = this._docLayer;
doclayer._updateCursorAndOverlay();
-
- if (acceptInput !== undefined)
+ } else if (acceptInput !== undefined) {
+ // A dialog has the focus.
this.focus(acceptInput);
+ }
},
// Our browser tab lost focus.
More information about the Libreoffice-commits
mailing list