[richfaces-svn-commits] JBoss Rich Faces SVN: r734 - trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri May 11 10:28:49 EDT 2007


Author: sergeyhalipov
Date: 2007-05-11 10:28:49 -0400 (Fri, 11 May 2007)
New Revision: 734

Modified:
   trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
Fix disappearance of suggestion box in Safari when an user clicks on scroll bar.

Modified: trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js	2007-05-11 12:01:44 UTC (rev 733)
+++ trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js	2007-05-11 14:28:49 UTC (rev 734)
@@ -81,6 +81,8 @@
             Event.observe(this.element, "keyup", this.onKeyUpListener);
             this.upDown = 0;
         }
+
+		this.onScrollListener = this.onScroll.bindAsEventListener(this);
     },
 
     onBoxKeyPress: function(event) {
@@ -130,12 +132,25 @@
     },
 
     show: function() {
+		if ("SAFARI" == RichFaces.navigatorType()) {
+			this.wasScroll = false;
+			if (!this.overflow)
+				this.overflow = document.getElementsByClassName("dr-sb-overflow", this.update)[0];
+	       	Event.observe(this.overflow, "scroll", this.onScrollListener);
+		}
         if (Element.getStyle(this.update, 'display')
                 == 'none') this.options.onShow(this.element, this.update, this.options);
         this.disableSubmit();
     },
 
     hide: function() {
+		if ("SAFARI" == RichFaces.navigatorType()) {
+			if (this.wasScroll) {
+				this.wasScroll = false;
+				return;
+			}
+			Event.stopObserving(this.overflow, "scroll", this.onScrollListener)
+		}
         this.stopIndicator();
         if (Element.getStyle(this.update, 'display')
                 != 'none') this.options.onHide(this.element, this.update, this.options);
@@ -178,6 +193,7 @@
             this.initialized = true;
         }
         if (this.active) {
+			this.wasScroll = false;
             switch (event.keyCode) {
                 case Event.KEY_TAB:
                 case Event.KEY_RETURN:
@@ -271,6 +287,7 @@
     },
 
     onClick: function(event) {
+		this.wasScroll = false;
         var element = Event.findElement(event, 'TR');
         this.index = element.autocompleteIndex;
         this.selectEntry(event);
@@ -299,6 +316,15 @@
         this.active = false;
     },
 
+	onScroll: function(event) {
+		if ("SAFARI" == RichFaces.navigatorType()) {
+			if(this.element) {
+				this.element.focus();
+				this.wasScroll = true;
+			}
+		}
+	},
+
     render: function() {
         if (this.entryCount > 0) {
             LOG.debug('render for index ' + this.index + " and old index "




More information about the richfaces-svn-commits mailing list