overlay won't disappear on IE6, errors saying that method is not valid for object

bangpound - March 31, 2009 - 22:14
Project:Popups API (Ajax Dialogs)
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

I've installed Popups API and the Popups test module on a fresh Drupal 6 installation. No other modules enabled except core required and popups API and popups test.

When I use any browser except IE, I have a good time. Popups open and close. All my difficulties are mine to bear.

When I use IE, the popup will close but the overlay will persist. Clicking the overlay won't make it go away. None of the links are clickable. Sometimes IE claims that there's an error on this line:

    Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack.  Probably should rework into .pop()

From this function.

Popups.removePopup = function(popup) { 
  if (!Popups.isset(popup)) {
    popup = Popups.activePopup();
  }
  if (popup) {
    popup.$popup().remove();
    Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack.  Probably should rework into .pop()
  } 
};

#1

longwave - April 1, 2009 - 13:53
Status:active» needs review

IE6 and 7 do not support the indexOf method on array objects, so the overlay is never removed. The attached patch replaces the indexOf call with an explicit loop through the array.

AttachmentSize
popups-419974.patch 800 bytes

#2

bangpound - April 1, 2009 - 14:29
Status:needs review» reviewed & tested by the community

I hate IE, but I love longwave.

Longwave shared this link in IRC, which may provide help to others who encounter this kind of problem in the future. http://soledadpenades.com/2007/05/17/arrayindexof-in-internet-explorer/

#3

silurius - April 2, 2009 - 22:31

If anyone can help me patch an alpha5 instance manually (text editor) I would be very grateful. I'd prefer to avoid the standard methods as it's it's been a long time, this is probably just one file and I have limited time. (Is this patch even viable for alpha5?)

Edited to add: Never mind, after studying the structure of the patch file I realized/remembered what the - and + symbols actually meant. :) I can confirm that the patch works here under alpha5 - fixes IE, doesn't break other browsers. One small thing to add to the issue: The gray overlay graphic does not cover the entire viewport. I run a zen fixed layout subtheme and when IE is full-screened, there are a couple of inches of web page visible outside the popup overlay on the left. (This part of the issue may only pertain to alpha5 for all I know).

#4

gcassie - April 17, 2009 - 19:25

Thanks, this was a big help. Fixed IE 6 & 7; FF 3 and Chrome are still happy.

#5

pivica - May 3, 2009 - 16:59

Tested and now it works for IE6&7. Thanks.

#6

zoo33 - May 4, 2009 - 15:38

Patch tested, works great!

#7

deviantintegral - May 6, 2009 - 21:32

This patch also works for me.

#8

RoboPhred - May 9, 2009 - 01:48

Since there is only one instance of the popup in the stack, the patch should break out of the for loop after it is found and spliced. There is no need to keep going down the array.

#9

davexoxide - May 20, 2009 - 17:03

this patch worked for me as well, thanks.

#10

jbrauer - July 6, 2009 - 14:15

This patch resolved the issue with IE in my usage as well.

#11

ghing - August 4, 2009 - 18:29

Here's a patch file that will work with the 6.x-2.0-alpha5 release.

AttachmentSize
popups-419974-6.x-20-alpha5.patch 703 bytes

#12

turadg - August 12, 2009 - 20:32

Are the committers deliberating on committing this patch?

http://drupal.org/node/199723/committers

User Last commit First commit Commits
starbow 19 weeks ago 1 year ago 337 commits
Takafumi 47 weeks ago 47 weeks ago 2 commits

#13

timtrinidad - August 13, 2009 - 15:45

Alternatively, you could use jQuery's inArray function instead of indexOf. (I didn't create a patch because I've already applied two other patches to popups.js...)

Change the line
Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack.  Probably should rework into .pop()
to
Popups.popupStack.splice(jQuery.inArray(popup,Popups.popupStack), 1); // Remove popup from stack.  Probably should rework into .pop()

#14

millenniumtree - August 28, 2009 - 14:20

w00t. Thanks longwave.

#15

drasgardian - September 11, 2009 - 04:17

applied patch from post #11 and it worked great.

#16

dboulet - November 2, 2009 - 18:31
Status:reviewed & tested by the community» needs review

Here's a patch for the fix in #13.

AttachmentSize
popups-DRUPAL-6--2_419974_ie.patch 705 bytes

#17

greg.harvey - November 5, 2009 - 13:13

I'm not sure about the latest patch. Is there any guarantee jquery will be available? I had a quick swizz through the module code and it seems to me full jquery is not necessarily available. I think this would require an additional piece of code to add jquery.js if it's not available already, and adding the whole of jquery.js might not be desired, when longwave's approach works just fine and has no dependencies...?

#18

greg.harvey - November 5, 2009 - 13:31

I'm a +1 for R&TBC for the patch in #11, btw. =)

EXCEPT! The file names at the top of the patch need sorting out - I would post, but don't want to confuse the current discussion point (jQuery or not jQuery?) ^^

#19

greg.harvey - November 5, 2009 - 15:05
Status:needs review» reviewed & tested by the community

I'm reliably informed (by longwave) that jquery is included anyway, so #16 should be cool. I've tested it and it works for me! =)

#20

dboulet - November 5, 2009 - 15:21
Status:reviewed & tested by the community» needs review

jQuery is part of Drupal core, and is automatically added to the page whenever drupal_add_js() is called—so yes, it is guaranteed to be available to all scripts in Drupal. Though the patch in #11 works, I think that a simpler solution that leverages jQuery makes more sense.

#21

dboulet - November 5, 2009 - 15:27
Status:needs review» reviewed & tested by the community

Oops, cross-posted.

#22

longwave - November 5, 2009 - 15:28

I was unaware that jQuery.inArray() existed when I first wrote the patch in #1, the patch in #16 is functionally the same but much cleaner to read than my version.

I've also sent a message to starbow asking to commit this patch as this issue has been around for six months now.

#23

setfree - November 9, 2009 - 18:38

sub

#24

longwave - November 11, 2009 - 16:28
Status:reviewed & tested by the community» fixed

Patch from #13 has been committed to the 6.x-2.x-dev branch.

#25

System Message - November 25, 2009 - 16:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.