Improve hint behaviour in webkit
Change-Id: Ib0dd00e4c54764afc13423c5f514afb3f7cad4ce
diff --git a/dev/js/src/hint/input.js b/dev/js/src/hint/input.js
index adb74b6..e61d820 100644
--- a/dev/js/src/hint/input.js
+++ b/dev/js/src/hint/input.js
@@ -146,13 +146,14 @@
// Create mirror for searchField
// This is important for positioning
// if ((this._mirror = document.getElementById("searchMirror")) === null) {
- this._mirror = document.createElement("div");
- this._mirror.classList.add('hint', 'mirror');
- this._mirror.appendChild(document.createElement("span"));
- this._container = this._mirror.appendChild(document.createElement("div"));
- this._mirror.style.height = "0px";
- document.getElementsByTagName("body")[0].appendChild(this._mirror);
-// };
+ this._mirror = document.createElement("div");
+ this._mirror.classList.add('hint', 'mirror');
+ this._mirror.appendChild(document.createElement("span"));
+ this._container = document.createElement("div");
+ this._mirror.appendChild(this._container);
+ this._mirror.style.height = "0px";
+ document.getElementsByTagName("body")[0].appendChild(this._mirror);
+ // };
// Update position of the mirror
window.addEventListener('resize', this.reposition.bind(this));
diff --git a/dev/js/src/hint/menu.js b/dev/js/src/hint/menu.js
index a7bdf57..105273e 100644
--- a/dev/js/src/hint/menu.js
+++ b/dev/js/src/hint/menu.js
@@ -1,12 +1,19 @@
/**
* Hint menu
*/
-define(['menu',
+define([
+ 'menu',
'hint/item',
'hint/prefix',
- 'hint/lengthField'], function (menuClass, itemClass, prefixClass, lengthFieldClass) {
- return {
+ 'hint/lengthField'
+], function (
+ menuClass,
+ itemClass,
+ prefixClass,
+ lengthFieldClass) {
+ return {
+
/**
* Create new hint helper menu.
*/
@@ -25,14 +32,20 @@
// Make the top item always active
obj._firstActive = true;
- // This is only domspecific
obj.element().addEventListener('blur', function (e) {
this.menu.hideWithoutDestruction();
});
// Focus on input field on hide
obj.onHide = function () {
- this._hint.unshow();
+ var h = this._hint;
+ h._inputField.element().focus();
+ if (h.active() !== null) {
+ if (h._alert.active) {
+ h._unshowAlert();
+ };
+ h.active(null);
+ };
};
return obj;