Permalink
Browse files

Better popup behavior in IE6–7, closes #2

  • Loading branch information...
1 parent 7ef8b5c commit b1c240285b5dfde6657cccc0a1fb8f5bd9976e95 @sergeche committed Jun 21, 2010
Showing with 20 additions and 6 deletions.
  1. +5 −3 content-assist.css
  2. +15 −3 src/ContentAssist.js
View
@@ -21,6 +21,7 @@
margin-top:1em;
padding:2px;
border:1px solid #d2d2d2;
+ zoom:1;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
@@ -39,10 +40,11 @@
.tx-ca-popup-content {
position:relative;
- min-width:100px;
- _width:100px;
overflow:auto;
overflow-x:hidden;
+ zoom:1;
+ min-width:100px;
+ _width:100px;
}
/* Content assist popup has scollable content */
@@ -84,6 +86,7 @@
.tx-proposal {
color:#242423;
font-family:'Lucida Grande', arial, sans-serif;
+ font-size:11px;
font-weight:bold;
line-height:20px; /* Set line-height in pixels for better look in Firefox */
padding:0 4px 1px 4px;
@@ -96,7 +99,6 @@
-ms-border-radius: 3px;
border-radius: 3px;
- -webkit-border-top-left-radius:0;
-webkit-border-top-left-radius:0;
-moz-border-radius-topleft:0;
border-top-left-radius:0;
View
@@ -95,10 +95,13 @@ function ContentAssist(viewer, processor, options) {
}
});
+ var dont_hide = false;
+
viewer.addEvent('blur', function() {
// use delayed execution in to handle popup click event correctly
- setTimeout(function() {
- that.hidePopup();
+ that.hide_timeout = setTimeout(function() {
+ if (!dont_hide) that.hidePopup();
+ dont_hide = false;
}, 200);
});
@@ -121,7 +124,6 @@ function ContentAssist(viewer, processor, options) {
tx_utils.addEvent(popup_content, 'click', function(/* Event */ evt) {
evt = tx_utils.normalizeEvent(evt);
var target = that.searchProposal(evt.target);
-
if (target) {
var ix = that.findProposalIx(target);
if (ix != -1) {
@@ -134,6 +136,13 @@ function ContentAssist(viewer, processor, options) {
tx_utils.addEvent(popup_content, 'mousedown', function(/* Event */ evt) {
evt = tx_utils.normalizeEvent(evt);
evt.preventDefault();
+ evt.stopPropagation();
+ dont_hide = true;
+ return false;
+ });
+
+ tx_utils.addEvent(document, 'mousedown', function(/* Event */ evt) {
+ that.hidePopup();
});
tx_utils.addEvent(this.additional_info, 'scroll', function(/* Event */ evt) {
@@ -204,12 +213,15 @@ ContentAssist.prototype = {
showPopup: function(x, y) {
this.popup.style.display = 'block';
this.popup.style.top = y + 'px';
+ this.popup.style.width = '';
// make some adjustments so popup won't appear outside the TextViewer box
var elem = this.viewer.getElement();
x = Math.min(elem.offsetLeft + elem.offsetWidth - this.popup.offsetWidth, x);
this.popup.style.left = x + 'px';
+ this.popup.style.width = this.popup_content.offsetWidth + 'px';
+
this.is_visible = true;
this.lockHover();
},

0 comments on commit b1c2402

Please sign in to comment.