Switch eventTrap from a <div> to an <input>

This prevents the appearance of various
'contextual' entries in a tooltip over
the caret in iOS.
This commit is contained in:
Aditya Bhatt
2014-02-24 12:55:35 +01:00
parent 8376adb05b
commit 1038583e85
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ gui.EventManager = function EventManager(odtDocument) {
},
/**@type{!Object.<string,!EventDelegate>}*/
eventDelegates = {},
/**@type{!HTMLDivElement}*/
/**@type{!HTMLInputElement}*/
eventTrap;
/**
@@ -334,7 +334,7 @@ gui.EventManager = function EventManager(odtDocument) {
doc = sizerElement.ownerDocument;
runtime.assert(Boolean(window), "EventManager requires a window object to operate correctly");
eventTrap = /**@type{!HTMLDivElement}*/(doc.createElement("div"));
eventTrap = /**@type{!HTMLInputElement}*/(doc.createElement("input"));
eventTrap.id = "eventTrap";
// Negative tab index still allows focus, but removes accessibility by keyboard
eventTrap.setAttribute("tabindex", -1);
+6 -2
View File
@@ -303,7 +303,7 @@
// https://bugzilla.mozilla.org/show_bug.cgi?id=773137
// https://bugzilla.mozilla.org/show_bug.cgi?id=787305
eventManager.blur();
eventTrap.setAttribute("contenteditable", false);
eventTrap.setAttribute('disabled', true);
}
/**
@@ -318,7 +318,11 @@
// the IME state after the content editable flag has been updated.
eventManager.blur();
}
eventTrap.setAttribute("contenteditable", isEditable);
if (isEditable) {
eventTrap.removeAttribute('disabled');
} else {
eventTrap.setAttribute('disabled', true);
}
if (hasFocus) {
eventManager.focus();
}