Jump to content

User hovercard can be inserted at the bottom of the page


Recommended Posts

Reported to me in https://linustechtips.com/topic/1443429-if-theres-a-username-behind-the-cursor-when-youre-reacting-to-a-post-the-hover-card-is-appended-to-the-bottom-page/ (there's a video there which illustrates the issue pretty well).

To reproduce:

  • Find a post that somebody else has reacted to
  • Open the react menu, and position the cursor above the username of the member that has already reacted, eg on funny in Could contain: Text
  • Click to react to the post
  • Have the request to ?do=showReactionsComment complete:
    • After the reaction menu has closed, so that the hovercard starts getting triggered due to the hover event on the username
    • Before the hovercard has finished loading
  • The hovercard will appear at the bottom of the page rather than in the correct location under the cursor

This happens because you take a reference to the hovered element when triggering the hovercard, but then when ?do=showReactionsComment completes the whole reactions block gets replaced, so the referenced element is no longer in the DOM.

I'm not sure what the right solution is here, though it could probably be helped by checking that the element exists in the DOM when trying to position the hovercard and aborting if not.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...