Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: Arantor on March 4th, 2012, 02:16 AM

Title: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 02:16 AM
All the 'cancel' link on an AJAX notification does is hide the 'Loading...' notification.

While we could theoretically just change the text to say 'close', I'd rather we either removed it entirely or we actually made it cancel. That shouldn't be too problematic, since we should be able to call .abort() on the object being used to handle the XHR itself (AIUI, jQuery > 1.5 exposes all methods from the XHR)

All we'd actually need to do is have it so that when we show the notification, we pass something to it by which we can call the abort... assuming we do that. If we don't, it gets a bit trickier to handle. Mind you... if we have two concurrent AJAX requests for whatever reason and both trigger 'Loading', it's impossible to know which would actually be cancelled.

Hmmm. Maybe it should just be renamed (or simply remove the hide button since having it really doesn't achieve anything useful)
Posted: March 1st, 2012, 02:50 PM

Bumpity. Inclined to simply remove the hide button, by the way, unless anyone has any burning issues with wanting to actually attempt to cancel the AJAX request?
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: live627 on March 4th, 2012, 03:20 AM
Unless the client goes offline during the request, would a human realistically be able rto move the mouse and click the button in less than a second?[1]
 1. So Thar's what the cancel_ajax is for. I always wondered why it was there, let alone its purpose.
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 11:47 AM
Sometimes, a server will go down while you're writing a quick edit. Happened to me. Clicking the close button only hid the banner but that's all. Iirc noisen uses an animated gif to show an action is being processed. Clicking the icon hides the banner. DFoes Wedge use that icon or Smf's?
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 02:13 PM
Wedge uses its own spinner image (not SMF's one), and something I never noticed before... somewhere along the change, the spinner itself is actually the cancel button, there's no separate cancel button any more.

This to me says 'remove', but more than that, the number of people who post on sm.org about issues with this do not realise there is a close button on it because it just 'hangs' there for them.
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 02:36 PM
Then it's behavior I implemented from noisen ;)

These people are the reason SMF added the button in the first place.
Posted: March 4th, 2012, 02:35 PM

Maybe show it after 3 seconds or so? :)
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 02:39 PM
Quote
These people are the reason SMF added the button in the first place.
But no-one uses it! Even when the button is immediately visible, no-one uses it. Making it visible after a period of time won't change that (and in any case you'd need to alter the behaviour so the spinner was more obviously a 'close' button than just being a spinner)

In any case, if the AJAX is taking that long to perform a lookup, odds are they should be coming to us for help anyway because something is obviously wrong...
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 02:41 PM
Then add a cancel link in plain text after 3s and remove the close link from the spinner?
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 02:44 PM
Which still takes us back to the original problem: you're just closing the notification, you're not closing the AJAX request, which seems like a waste to me.

More than that, most of the time it breaks, it's not breaking because of the connection/page being slow to serve but that the response returned is invalid, so really having it cancel the request isn't that useful in most cases, and IMO neither is closing the notification. What we should be doing is error handling it instead.
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 03:26 PM
Afaik the Ajax box is always closed once a response is received, whether correct or not..?
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 03:28 PM
I haven't tried it in Wedge with jQuery but certainly in SMF, if the response returned to getXMLDocument or sendXMLDocument was invalid, it would hit an error and end processing before it got to close the box.

There's no actual error handling attached, no warning to the user, the only things that are visible are the lingering box and the fact that what they asked for may not have been done.
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 03:31 PM
Hmm. We could add a fallback on failure. jQuery supports that indeed.
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 03:34 PM
Displaying a nice message to the user would solve that part. Then we could remove the button (leaving the spinner in for a nice look? Or simply removing it entirely, either works)
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Nao on March 4th, 2012, 03:35 PM
I'll think about it once I'm back home tonight.
Please reply here so I don't mark this as done :p
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on March 4th, 2012, 03:39 PM
Well, you'd only have to attach it in two places - in the master getXmlDocument and sendXmlDocument handlers, everything else should be using those from what I remember (instead of raw jQuery $.ajax) and then everything works :)
Title: Re: SMF bug 4962 (pressing cancel on the AJAX notification doesn't cancel it)
Post by: Arantor on August 1st, 2013, 04:53 AM
Marking as solved since the loading stuff has been rewritten and there isn't a cancel button.