Last modified: 2014-04-22 14:40:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65159, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63159 - Hovercards: Incorrect card placement for links with a line break
Hovercards: Incorrect card placement for links with a line break
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Popups (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Prateek Saxena
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-27 00:56 UTC by Prateek Saxena
Modified: 2014-04-22 14:40 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
testcase (140.30 KB, image/png)
2014-03-27 00:56 UTC, Prateek Saxena
Details
fixedissue (12.29 KB, image/png)
2014-04-13 02:33 UTC, Prateek Saxena
Details

Description Prateek Saxena 2014-03-27 00:56:54 UTC
Created attachment 14934 [details]
testcase
Comment 1 kipod 2014-04-02 14:28:05 UTC
the solution is simple: display the card based on mouse location rather than the location of the element that triggered it.

there are other reasons for this: e.g., one might want to create a card for large elements (say, hovercard for an image), and the expectation is that the card will be near the mouse pointer, not fixed based on element location, which may be pretty far from the mouse for large element.

btw - this is the way browsers display tooltips: if you have an image tooltip, it will show relative to the mouse, not to the image, so doing it the way i describe is meeting users' expectations.

peace.
Comment 2 Vibha Bamba 2014-04-11 00:36:24 UTC
Agree, Discussed with Prateek.
Comment 3 kipod 2014-04-11 16:21:38 UTC
(In reply to Vibha Bamba from comment #2)
> Agree, Discussed with Prateek.

i posted on [[mw:Extension talk:Popups]] [1] an outline of how i think this could/should be implemented.

peace.

______________________________
hope this link works - otherwise treat it as text: "Extension talk:Popups: on mw wiki. no "preview" on bugzilla...
Comment 4 Gerrit Notification Bot 2014-04-13 02:25:30 UTC
Change 125577 had a related patch set uploaded by Prtksxna:
Position hovercard according to mouse position

https://gerrit.wikimedia.org/r/125577
Comment 5 Prateek Saxena 2014-04-13 02:28:20 UTC
The issue with this approach is that sometimes the hovercard will collide with the link. This will happen if the mouse entered the link from the top.

The event gets triggered as soon as the mouse enters the link and that position is taken for placement, the mouse might have moved in this much time. If we move the hovercard along with mouse movement it'll become like the sample that Dan has shown during the meeting - is that something we want? - I don't.
Comment 6 Prateek Saxena 2014-04-13 02:33:14 UTC
Created attachment 15091 [details]
fixedissue
Comment 7 kipod 2014-04-16 23:31:16 UTC
(In reply to Prateek Saxena from comment #5)
> The issue with this approach is that sometimes the hovercard will collide
> with the link. This will happen if the mouse entered the link from the top.
> 
> The event gets triggered as soon as the mouse enters the link and that
> position is taken for placement, the mouse might have moved in this much
> time. If we move the hovercard along with mouse movement it'll become like
> the sample that Dan has shown during the meeting - is that something we
> want? - I don't.

since the whole card serves as a link, obscuring the link does not seem like such a problem to me. i think this is the correct behavior, since we have no control over the element: it can be a very ling title, that spans the whole line, and of course, when the link gets word-wrapped, there is no way to place the card based on the element location that will work as expected in all cases (remember that browser's tooltip are poped relative to the mouse pointer).

if this seems critical, it should be easy enough to take the element location into consideration and make a slight adjustment to try and not obscure the element, but the location should be based the mouse pointer and not the element.

peace.
Comment 8 Vibha Bamba 2014-04-16 23:52:39 UTC
Prateek, any pending concerns here?
Comment 9 kipod 2014-04-17 21:07:25 UTC
(In reply to Vibha Bamba from comment #8)
> Prateek, any pending concerns here?

i have a small concern: the event that triggers the popup can be either "mouseenter" or "focus".
 
now, "focus" events do not contain viable "pageX" and "pageY" fields, so it may be better to do something like:

offsetTop = (event.type == 'mouseenter'
    ? event.pageY + 20 
    : $el.offset().top + $el.height() + 9);

and similarly for offsetLeft.

no? 

peace.
Comment 10 Quiddity 2014-04-20 17:22:12 UTC
(In reply to Prateek Saxena from comment #5)
[..]
> time. If we move the hovercard along with mouse movement it'll become like
> the sample that Dan has shown during the meeting - is that something we
> want? - I don't.

We definitely don't want it to move-around once visible. (Eg. Hovering on the items in the table lower down on this page: http://www.wowhead.com/items ) Because that's annoying, and it makes it impossible to click the popup!

But the way that Navpopups does it, would be fine, and solve this bug. (It opens the popup wherever the mouse comes-to-rest, and ignores subsequent movements as long as the mouse is still over the link or the popup.)
Comment 11 Prateek Saxena 2014-04-20 23:09:56 UTC
(In reply to kipod from comment #9)
> i have a small concern: the event that triggers the popup can be
> either "mouseenter" or "focus"

Thanks for pointing this out, I'll update the patch.
Comment 12 Gerrit Notification Bot 2014-04-22 11:04:31 UTC
Change 125577 merged by jenkins-bot:
Position hovercard according to mouse position

https://gerrit.wikimedia.org/r/125577
Comment 13 Bartosz Dziewoński 2014-04-22 14:40:25 UTC
This looks fixed, too.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links