Merge lp:~deryck/launchpad/pop-up-help-positioning-574682 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Eleanor Berger
Approved revision: no longer in the source branch.
Merged at revision: 10844
Proposed branch: lp:~deryck/launchpad/pop-up-help-positioning-574682
Merge into: lp:launchpad
Diff against target: 11 lines (+2/-0)
1 file modified
lib/lp/services/inlinehelp/javascript/inlinehelp.js (+2/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/pop-up-help-positioning-574682
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code ui Approve
Review via email: mp+24943@code.launchpad.net

Commit message

Fix positioning of pop-up help overlays.

Description of the change

This fixes bug 574682. It makes pop-up help overlays consider the viewport position as part of the setElementPosition call. Currently on Launchpad, pop-up help is positioned off screen if you scroll down the page and then select the help icon (on tags, for example).

I have no idea how to test this since it's MochiKit-based. I'm happy to learn and write a test if we have anything for MochiKit-based code.

Cheers,
deryck

To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

Thanks for fixing this annoying bug. I don't think it's necessary to add a test (you could use Windmill if you really wanted), but I wonder if any consideration has been given to converting this to use LAZR-JS. I very vaguely remember Maris talking about it at some point. Maybe it's worth letting him know that we're now fixing bugs in this legacy code.

The fix looks fine and works well. You can remove the if statement. It is not necessary and I don't think aids readability. Up to you.

review: Approve (code ui)
Revision history for this message
Deryck Hodge (deryck) wrote :

Hi, Tom.

Thanks for the review.

I looked into converting to lazr-js myself, but I didn't have time to invest when a simple fix will work. There are still other, deeper dependencies on MochiKit than this bit of code, so it didn't seem worth it to me for now. I don't think it's worth a Windmill test, either, to be honest.

I did remove the if statement. I thought it was a bit more clear why this was needed with the if statement, but no harm without either, so I dropped it.

Thanks again for the review today.

Cheers,
deryck

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/inlinehelp/javascript/inlinehelp.js'
2--- lib/lp/services/inlinehelp/javascript/inlinehelp.js 2010-01-12 16:43:00 +0000
3+++ lib/lp/services/inlinehelp/javascript/inlinehelp.js 2010-05-10 22:24:27 +0000
4@@ -99,6 +99,8 @@
5 var help_pane_dim = elementDimensions('help-pane');
6 var pos_x = Math.round(viewport_dim.w / 2) - (help_pane_dim.w / 2);
7 var pos_y = Math.round(viewport_dim.h / 2) - (help_pane_dim.h / 2);
8+ var viewport_pos = getViewportPosition();
9+ pos_y += viewport_pos.y;
10 setElementPosition(help_pane, new Coordinates(pos_x, pos_y));
11 makeVisible(help_pane);
12