Dushan Hanuska, JIRA Developer

This is a continuation to my previous post where I claimed that IE is broken. Well, it seems that it is not the only one.

Opera has problems of its own kind. When it comes to positioning pop-up windows, there is a difference between the x and y you set and you get as well.

Moving a pop-up window moves its top left corner relatively to the top left corner of its parent window. Unlike in other browsers, where a new pop-up window is treated as equal to its parent, Opera opens a pop-up window as a new tab. This window appears on top of its parent's window content, but its visibility is restricted to the parent's content area.

opera0.png

In other words, the pop-up window cannot be dragged outside, e.g. you cannot place the pop-up and the parent windows side by side.

opera1.png

That would not be so bad, only if window.screenLeft and window.screenTop returned the values that were relative to its parent window. Unfortunately, that's not the case. Opera returns x and y of the top left corner measured from the top left corner of the screen. That's right, x and y are taken as if this pop-up window was a stand-alone window, not a child of the window that opened it.

So how did we fix this 'bug'? We didn't. What we did was

if (!window.opera) window.moveTo(x,y);

That's right, we ignore Opera completely when it comes to positioning this pop-up window. Let's let Opera decide where it pops windows up. Don't you love browser differences?!

Peace!

6 Comment(s)

In fact you _can_ drag the window outside Opera's main window. Just grab the tab and pull it out. You then get a full Opera window.

Nice post, though.

By Gunnar Velle at February 27, 2008 12:00 AM

I think the main thing to get from this exercise is not that browser differences are evil, but perhaps that pop ups are? Need I remind you the accessibility and usability issues with pop ups? Just a reminder.

By Alexander Johannesen at February 27, 2008 12:43 AM

What might make things even worse is that this is configurable behavior in Opera (at least with the 9.50 beta.) I have a hunch that if someone had 'open windows instead of tabs' the behavior would be the same. Couldn't tell you if it was laziness or cleverness that led the Opera developers to use the same method for both scenarios (if that is indeed the case.)

I use Opera every day with all manner of Atlassian products (Jira, Bamboo and FishEye) and frankly, I never notice where my popups appear. As long as they don't run off the screen I'm happy. :)

By MattyJ at February 27, 2008 10:48 AM

Thanks Gunnar! You can obviously tell that I am not an Opera user :-)

I also agree with Alexander. Pop-ups are evil! Browser differences less so.

By Dushan Hanuska at February 27, 2008 5:55 PM

That popup windows by default appear as tabs and are fully flexible inside the main Opera workspace is one of the nicest features of Opera's tab/window handling. Being a long-time Opera user (since Opera 2 or 3 something) I remember when they solved one of the problems with the usual Windows Multiple Document Interface, namely that all sub-windows either are maximised or non-maximised. Probably sometime around Opera 3 or 4 all of a sudden popups would appear inside the workspace with the dimensions the developer wanted, and leave other maximised MDI child windows in their maximised state - I didn't know much about software back then but I remember being impressed by the new feature :-)

I'm not entirely sure of your use case for remembering the position so maybe I'd understand what you need if I had the full picture. I'm sure I can get window.screenLeft and screenTop fixed if you really need it :-)

By Hallvord R. M. Steen at February 28, 2008 3:02 AM

And actually, you can still get real popup windows in Opera... in Preferences>Advanced>Tabs there's an option to "Open windows instead of tabs" (it's the last option in that preferences group), and voila, your popup pops up outside the parent window, and appears on the Windows taskbar as well.

I quite like it that way, but whenever I click a link from my newsreader it also opens up in a new window, instead of the preferable new tab... so I leave it unchecked.

By Louis at March 8, 2008 2:57 AM

Post a comment

If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.





Remember personal info?

Type the characters you see in the picture above.