loleaflet: Focus on textarea after map activation

So that user does not have to click again into the document to
start typing.

Change-Id: Iaf1993a9a331ab86c668e718fae5f6a727c120cc
This commit is contained in:
Pranav Kant 2016-12-22 15:46:48 +05:30
parent 4199efc91c
commit e35fe1c826

View file

@ -567,7 +567,9 @@ L.Map = L.Evented.extend({
}, },
focus: function () { focus: function () {
console.debug('focus:');
if (this._docLayer && document.activeElement !== this._docLayer._textArea) { if (this._docLayer && document.activeElement !== this._docLayer._textArea) {
console.debug('focus: focussing');
this._docLayer._textArea.focus(); this._docLayer._textArea.focus();
} }
}, },
@ -754,6 +756,7 @@ L.Map = L.Evented.extend({
var id = vex.dialogID; var id = vex.dialogID;
vex.dialogID = -1; vex.dialogID = -1;
this._startInactiveTimer(); this._startInactiveTimer();
this.focus();
return vex.close(id); return vex.close(id);
} }
} else { } else {
@ -762,6 +765,7 @@ L.Map = L.Evented.extend({
} }
this._startInactiveTimer(); this._startInactiveTimer();
this.focus();
return false; return false;
}, },