Opened 12 years ago

Closed 11 years ago

#5190 closed defect (fixed)

[patch/cla] nodes underneath toaster become inaccessible

Reported by: guest Owned by: dante
Priority: high Milestone:
Component: Dojox Version: 1.0
Keywords: toaster Cc:
Blocked By: Blocking:

Description

After toaster displaying and hiding all nodes under toaster become inaccessible. For example, I cannot enter <input/> if toaster was displayed over it. Problem in toaster domNode - it remains visible after toaster hided (only containerNode hides). This simple patch will correct this problem

Index: dojox/widget/Toaster.js
===================================================================
--- dojox/widget/Toaster.js	(revision 11576)
+++ dojox/widget/Toaster.js	(working copy)
@@ -222,7 +222,7 @@
 
 		show: function(){
 			// summary: show the Toaster
-			dojo.style(this.containerNode, 'display', '');
+			dojo.style(this.domNode, 'display', 'block');
 
 			this._placeClip();
 
@@ -235,7 +235,7 @@
 			// summary: hide the Toaster
 
 			//Q: ALP: I didn't port all the toggler stuff from d.w.HtmlWidget.  Is it needed? Ditto for show.
-			dojo.style(this.containerNode, 'display', 'none');
+			dojo.style(this.domNode, 'display', 'none');
 
 			if(this._scrollConnected){
 				dojo.disconnect(this._scrollConnected);

Attachments (1)

dojox.diff (3.7 KB) - added by guest 11 years ago.
file version of path - no changes to last one

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by Adam Peller

Owner: changed from Tom Trenka to Adam Peller
Summary: [toaster]nodes underneath toaster become inaccessible

thanks for the patch. va test case would be helpful.

comment:2 Changed 11 years ago by guest

Vladimir Solomenchuk/cla following patch fixes:

  1. access to nodes nodes under tooltip
  2. it case of duration==0, toaster remains displayed after adding messages with duration!=0
  3. toaster hides after click in case of duration!=0
Index: widget/Toaster.js
===================================================================
--- widget/Toaster.js	(revision 11840)
+++ widget/Toaster.js	(working copy)
@@ -92,7 +92,7 @@
 				}
 				if(this.slideAnim.status() == "playing" || (this.fadeAnim && this.fadeAnim.status() == "playing")){
 					setTimeout(dojo.hitch(this, function(){
-						this.setContent(message, messageType);
+						this.setContent(message, messageType, duration);
 					}), 50);
 					return;
 				}
@@ -120,9 +120,13 @@
 			// bottom right of page and up
 			this.show();
 			var nodeSize = dojo.marginBox(this.containerNode);
-			
+			this._cancelHideTimer();
 			if(this.isVisible){
 				this._placeClip();
+				//update hide timer if no sticky message in stack 
+				if (!this._stickyMessage)
+					this._setHideTimer(duration);
+
 			}else{
 				var style = this.containerNode.style;
 				var pd = this.positionDirection;
@@ -142,7 +146,6 @@
 				}else{
 					throw new Error(this.id + ".positionDirection is invalid: " + pd);
 				}
-
 				this.slideAnim = dojo.fx.slideTo({
 					node: this.containerNode,
 					top: 0, left: 0,
@@ -158,22 +161,14 @@
 							this.isVisible = false;
 							this.hide();
 						});
-						//if duration == 0 we keep the message displayed until clicked
-						//TODO: fix so that if a duration > 0 is displayed when a duration==0 is appended to it, the fadeOut is canceled
-						if(duration>0){
-							setTimeout(dojo.hitch(this, function(evt){
-								// we must hide the iframe in order to fade
-								// TODO: figure out how to fade with a BackgroundIframe
-								if(this.bgIframe && this.bgIframe.iframe){
-									this.bgIframe.iframe.style.display="none";
-								}
-								this.fadeAnim.play();
-							}), duration);
-						}else{
-							dojo.connect(this, 'onSelect', this, function(evt){
-								this.fadeAnim.play();
-							});
-						}
+						this._setHideTimer(duration);
+						dojo.connect(this, 'onSelect', this, function(evt){
+							this._cancelHideTimer();
+							//force clear sticky message
+							this._stickyMessage=false;
+							this.fadeAnim.play();
+						});
+
 						this.isVisible = true;
 					});
 				this.slideAnim.play();
@@ -179,7 +174,32 @@
 				this.slideAnim.play();
 			}
 		},
-
+		_cancelHideTimer:function(){
+			if (this._hideTimer){
+				clearTimeout(this._hideTimer);
+				this._hideTimer=null;
+			}
+		},
+		_setHideTimer:function(duration){
+			this._cancelHideTimer();
+			//if duration == 0 we keep the message displayed until clicked
+			if(duration>0){
+				this._cancelHideTimer();
+				this._hideTimer=setTimeout(dojo.hitch(this, function(evt){
+					// we must hide the iframe in order to fade
+					// TODO: figure out how to fade with a BackgroundIframe
+					if(this.bgIframe && this.bgIframe.iframe){
+						this.bgIframe.iframe.style.display="none";
+					}
+					this._hideTimer=null;
+					//force clear sticky message
+					this._stickyMessage=false;
+					this.fadeAnim.play();
+				}), duration);
+			}
+			else
+				this._stickyMessage=true;
+		},
 		_placeClip: function(){
 			var view = dijit.getViewport();
 
@@ -222,7 +242,7 @@
 
 		show: function(){
 			// summary: show the Toaster
-			dojo.style(this.containerNode, 'display', '');
+			dojo.style(this.domNode, 'display', 'block');
 
 			this._placeClip();
 
@@ -235,7 +255,7 @@
 			// summary: hide the Toaster
 
 			//Q: ALP: I didn't port all the toggler stuff from d.w.HtmlWidget.  Is it needed? Ditto for show.
-			dojo.style(this.containerNode, 'display', 'none');
+			dojo.style(this.domNode, 'display', 'none');
 
 			if(this._scrollConnected){
 				dojo.disconnect(this._scrollConnected);

comment:3 Changed 11 years ago by dante

Owner: changed from Adam Peller to dante

comment:4 Changed 11 years ago by dante

Summary: nodes underneath toaster become inaccessible[patch/cla] nodes underneath toaster become inaccessible

great thanks! in the future though, it's tons easier if you use the 'attach file' to attach your patch (eliminates the chance of a paste error, line breaks, etc, and also makes highlighted diffs, and can download the .diff without effort) ... thanks again. will review.

Changed 11 years ago by guest

Attachment: dojox.diff added

file version of path - no changes to last one

comment:5 Changed 11 years ago by dante

Resolution: fixed
Status: newclosed

(In [11903]) fixes #5190 - merge cla/patch and additional cleanups to dojox.widget.Toaster - thanks vladimir, good looking patch.

Note: See TracTickets for help on using tickets.