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

Mihai Varga mihai.varga at collabora.com
Wed Jul 1 02:27:41 PDT 2015


 loleaflet/src/layer/tile/TileLayer.js |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit a28c688a5474fe5e8a2d5cb899677ccfc413dde9
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Wed Jul 1 12:27:21 2015 +0300

    Fix some keys on chrome + preventDefault for tab

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 423d87e..b63a2f3 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -857,10 +857,11 @@ L.TileLayer = L.GridLayer.extend({
 
 		var charCode = e.originalEvent.charCode;
 		var keyCode = e.originalEvent.keyCode;
-		if (e.type === 'keydown' && this.handleOnKeyDown[keyCode]) {
+		if (e.type === 'keydown' && this.handleOnKeyDown[keyCode] && charCode === 0) {
 			this._postKeyboardEvent('input', charCode, this._toUNOKeyCode(keyCode));
 		}
-		else if (e.type === 'keypress' && !this.handleOnKeyDown[keyCode]) {
+		else if (e.type === 'keypress' &&
+				(!this.handleOnKeyDown[keyCode] || charCode !== 0)) {
 			if (charCode === keyCode && charCode !== 13) {
 				// Chrome sets keyCode = charCode for printable keys
 				// while LO requires it to be 0
@@ -871,6 +872,10 @@ L.TileLayer = L.GridLayer.extend({
 		else if (e.type === 'keyup') {
 			this._postKeyboardEvent('up', charCode, this._toUNOKeyCode(keyCode));
 		}
+		if (keyCode === 9) {
+			// tab would change focus to other DOM elements
+			e.originalEvent.preventDefault();
+		}
 	},
 
 	// Is rRectangle empty?


More information about the Libreoffice-commits mailing list