jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.7k stars 2.41k forks source link

ui-page-active removed from still-active page? #1234

Closed paulshapiro closed 13 years ago

paulshapiro commented 13 years ago

Hi guys,

Thanks for the awesome lib, first of all.

I've been coding with jQuery Mobile for a few days now and no issues until just yesterday, when suddenly some change I made caused the app to suddenly display a white (blank) page only, after certain events, like a phonegap navigator.notifications.alert, and also link clicks that involve transitions.

I did a little bit of poking around and found out that, at least in the case of the navigator.notifications.alert (which is really just a customized alert()), the ui-page-active class gets removed from the page which is meant to be active.

I've heard other users reporting stuff similar to this, but perhaps nothing exactly the same.

I'm using 1.0a3.

Any advice/help would be much appreciated. Ship date is soon and I thought that it was working just fine until this happened at the last moment.

I've gone through my code and am pretty sure I'm not doing something funky, but it's strange that this happened so suddenly too.

Thanks Paul

paulshapiro commented 13 years ago

Oh yes, I'm using the iPhone Simulator with PhoneGap 0.9.4 and jQuery 1.5.1.

scottjehl commented 13 years ago

That's an interesting one. Does PhoneGap use the DOM for these alerts? Does it change the location hash?

toddparker commented 13 years ago

This will be pretty hard to debug like this. If you can narrow this down and post a page that isolates the issue, we may be able to take a look but this may be a better question for the forums since it's not really a clear JQM issue. Maybe Phonegap is changing the hash or doing something else that is tripping up the navigation?

paulshapiro commented 13 years ago

Curiously, window.location.hash seems to be empty,

  1. after body load,
  2. before link click, and
  3. after link click.

That's not normal, right?

scottjehl commented 13 years ago

Doesn't sound it. Are ajax and transitions enabled and working?

On Mar 14, 2011, at 3:20 PM | Mar 14, 2011, paulshapiro wrote:

Curiously, window.location.hash seems to be empty,

  1. after body load,
  2. before link click, and
  3. after link click.

That's not normal, right?

Reply to this email directly or view it on GitHub: https://github.com/jquery/jquery-mobile/issues/1234#comment_870805

paulshapiro commented 13 years ago

Yep, they're both enabled and working, but I do get a white page immediately after a transition. I'm sitting here trying to figure out why window.location.hash is always empty... and not getting very far.

paulshapiro commented 13 years ago

It turns out that window.location.hash is not always empty. It seems to be empty before any transitions/page changes have taken place. I do a setTimeout to alert the hash and I can see before and after the transition that it changes.

scottjehl commented 13 years ago

Is it changing to anything different during the alert?

On Mar 14, 2011, at 3:56 PM | Mar 14, 2011, paulshapiro wrote:

It turns out that window.location.hash is not always empty. It seems to be empty before any transitions/page changes have taken place. I do a setTimeout to alert the hash and I can see before and after the transition that it changes.

Reply to this email directly or view it on GitHub: https://github.com/jquery/jquery-mobile/issues/1234#comment_871307

paulshapiro commented 13 years ago

Not exactly sure I understood what you mean, but I have done two setTimeouts to see if the hash changes after the initial alert of it, and confirmed that it does not change. So the page is blank while there is a non-empty hash. Gotta narrow this down like todd parker suggested, but was hoping to avoid that.

paulshapiro commented 13 years ago

Okay, really stripped down example here. I'm going to post this on the PhoneGap forum too. Thanks for looking.

http://pastebin.com/fZLGzfJ1

Edit: Even more stripped down showing same issue. (http://pastebin.com/PRFcb2g4) Note that this issue does not appear in desktop Safari.

paulshapiro commented 13 years ago

Alright, I feel like a complete idiot.

I was doing this:

Take that out and guess what... no more issue! This can be closed.