зеркало из https://github.com/mozilla/gecko-dev.git
Bug 766066 - Part 3: Open keyboard when user taps input element, not when panning. r=djf
--HG-- extra : rebase_source : 69db692037f659f47c5560b7d1f9c36179e1aa69
This commit is contained in:
Родитель
a30a7b800b
Коммит
1f7ba4cc13
|
@ -71,6 +71,7 @@ let FormAssistant = {
|
|||
return;
|
||||
|
||||
if (this.focusedElement) {
|
||||
this.focusedElement.removeEventListener('click', this);
|
||||
this.focusedElement.removeEventListener('mousedown', this);
|
||||
this.focusedElement.removeEventListener('mouseup', this);
|
||||
if (!element) {
|
||||
|
@ -79,6 +80,7 @@ let FormAssistant = {
|
|||
}
|
||||
|
||||
if (element) {
|
||||
element.addEventListener('click', this);
|
||||
element.addEventListener('mousedown', this);
|
||||
element.addEventListener('mouseup', this);
|
||||
}
|
||||
|
@ -95,9 +97,10 @@ let FormAssistant = {
|
|||
if (this.isTextInputElement(target) && this.isIMEDisabled())
|
||||
return;
|
||||
|
||||
// We got input focus, but don't open the virtual keyboard unless we
|
||||
// get a 'click' event, i.e. the user is tapping the input element.
|
||||
if (target && this.isFocusableElement(target)) {
|
||||
this.setFocusedElement(target);
|
||||
this.showKeyboard(target);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -125,6 +128,14 @@ let FormAssistant = {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'click':
|
||||
// We only listen for click events on the currently focused element.
|
||||
// Gecko fires a click event if the user "taps" an input element
|
||||
// without dragging. This is how we differentiate tap gestures to set
|
||||
// input focus (and open the keyboard) from simply panning the page.
|
||||
this.showKeyboard();
|
||||
break;
|
||||
|
||||
case "resize":
|
||||
if (!this.isKeyboardOpened)
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче