enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

Viewport containment doesn't work for fixed tooltips #42

Closed abyx closed 11 years ago

abyx commented 11 years ago

It seems like when fixed: true is being passed to the tooltip, the code that makes sure the tooltip is displayed within the viewport isn't run? I'd love to get a quick workaround for that (I need fixed: true to allow the user to select text from the tooltip itself, which isn't possible when the tooltip keeps running away)

abyx commented 11 years ago

Well, I got a really ugly hack to make it seem to work with fixed tooltips, but it's not something I'd like to use since I don't have a thorough understanding of the code. A diff of my hack is available here. Basically, I changed the code so that it would get another mouse event after showing the tooltip (by still following it) and then allow a single repositioning post showing (which I'm guessing would screw up non fixed, but easy to make it right). If this helps you fix this solidly I'd be grateful!

enyo commented 11 years ago

Hi, I'm really sorry that you seem to experience every last problem there is with Opentip. I was under extreme time pressure those last days (weeks) and am in the studio again the next weeks, but I hope I get some time tomorrow to inspect and fix the problems you experience. Thanks for your patience and your efforts to figure out the problems yourself.

abyx commented 11 years ago

Thanks a lot. And you shouldn't apologize, since it's open source and the reason I'm using it is because it's the best one that I've found for my needs. Code is hard, sometimes it doesn't work perfectly, even more so with javascript widgets :)

abyx commented 11 years ago

Hey, I saw you closed this. Was this fixed by 5a5c8fd2d277a228013131f8143ddc6bfa68a95f ? Or was it some other commit?

enyo commented 11 years ago

Oh. I thought it was fixed by a12db3bdc050de677a92097b080f52067ef2c2df. I'lll reopen the issue until I've verified it.

abyx commented 11 years ago

Hey. I just wanted to know whether you think this will be fixed soon. No pressure, I just need to know if I need to use my patched workaround version on production or not and want to plan for it. Thanks!

enyo commented 11 years ago

Hi. I'll try to do it in the next 2-3 days. Cheers

abyx commented 11 years ago

enyo commented 11 years ago

Ok. The problem seems to only appear when the tooltip is not fixed to an element, but at the mouse cursor position. This way, when the browser gets resized, the Tooltip is being replaced at mouse position, which has changed since the time it appeared.

So as a quick workaround, set a target for the opentip, and your problem should be solved. I'll look into how much the other solution would be. (But as a ground rule I suggest adding a target when you choose a fixed tooltip)

enyo commented 11 years ago

Ok. It was quite easy to fix. Although leaving the tooltip at mouse position gives some weird effects when the website content is centred it behaves as expected now.

abyx commented 11 years ago

YES! Looks great here. Thank you so so much. I owe you a :beer:, shall we ever cross paths :)

enyo commented 11 years ago

If I ever get the chance to visit Israel I'll take you up on that offer!