Fixed bluring on hint menus for chrome - fixed #46 and #38
Change-Id: Idc57b612c423d72f54f2d4499e0e91cbf71732ac
diff --git a/dev/demo/hintdemo.js b/dev/demo/hintdemo.js
index 7882787..e33faab 100644
--- a/dev/demo/hintdemo.js
+++ b/dev/demo/hintdemo.js
@@ -7,7 +7,7 @@
var hint = undefined;
-require(['hint','hint/array','lib/domReady'], function (hintClass, hintArray, domReady) {
+require(['hint','hint/foundries/cnx','lib/domReady'], function (hintClass, hintArray, domReady) {
KorAP.hintArray = hintArray;
KorAP.Hint = null;
domReady(function() {
diff --git a/dev/js/src/hint.js b/dev/js/src/hint.js
index 19c360f..e1b0796 100644
--- a/dev/js/src/hint.js
+++ b/dev/js/src/hint.js
@@ -259,7 +259,7 @@
// Remove the active object
this._unshow();
-
+
// Get the menu
var menu;
if (menu = this.contextMenu(ifContext)) {
@@ -300,12 +300,12 @@
_unshow : function () {
if (this.active() !== null) {
// var act = this.active();
-
+
// This does not work for alert currently!
//if (act._type !== 'alert') {
if (!this._alert.active) {
var c = this._inputField.container();
- c.removeChild(this._active.element());
+ c.removeChild(this._active.element());
}
else {
this._unshowAlert();
diff --git a/dev/js/src/hint/menu.js b/dev/js/src/hint/menu.js
index fcf3fc6..dd99d1f 100644
--- a/dev/js/src/hint/menu.js
+++ b/dev/js/src/hint/menu.js
@@ -27,7 +27,7 @@
// This is only domspecific
obj.element().addEventListener('blur', function (e) {
- this.menu.hide();
+ this.menu.hideWithoutDestruction();
});
// Focus on input field on hide
@@ -44,6 +44,16 @@
*/
hint : function () {
return this._hint;
+ },
+
+ /**
+ * Hide the menu just for the moment,
+ * without cleaning up anything.
+ */
+ hideWithoutDestruction : function () {
+ this.element().classList.remove("visible");
+ if (this._hint)
+ this._hint.inputField().element().focus();
}
};
});