jquery-powertip icon indicating copy to clipboard operation
jquery-powertip copied to clipboard

Tooltip does not close when clicking on a link with a target of _blank

Open stevenbenner opened this issue 13 years ago • 1 comments

If a link has a tooltip and the target attribute is set to _blank (which causes the linked resource to open in a new tab/window) the tooltip will not close by itself when the user activates that link. This is a minor problem for a fixed placement tooltip, but if the tooltip is set to follow the mouse it is a much more objectionable problem.

Probable cause:

  • This is probably happening because the activated link receives focus and does not blur when used.

Desired behavior:

  • When the user activates a link that opens a new tab or window the tooltip should close.

Possible solutions:

  • Perhaps tooltips should close when the window looses focus or the mouse leaves the window.
  • Maybe mouse-follow tooltips should not respond to keyboard navigation events.

stevenbenner avatar Aug 23 '12 04:08 stevenbenner

It turns out that this is not a bug, or at least not the problem that was originally described.

Results of testing

When a link opens a new tab in Firefox (testing with version 15.0.1) the blur event propagates properly, causing the tooltip to close. Then, when the user switches back to the tab with the tooltip the focus event propagates, causing the tooltip to re-open. You can clearly see this effect if you set the fadeInTime to 1000ms or more. This behavior is perfectly acceptable.

Internet Explorer (testing with version 9), behaves similarly to Firefox with regular link clicks.

Chrome (testing with version 22.0.1229.79) takes an extra step and removes focus from a link when you click on it, so it never re-opens.

The real problem

When the tooltip is set to follow the mouse users do not expect a tooltip to be following a cursor that is not over an element with a tooltip, which is exactly what happens when that element receives focus from the tab cursor during a click.

Possible solutions

Right now I see two possible solutions:

  1. Do not open mouse-follow tooltips for the keyboard cursor events (focus and blur), or
  2. When a mouse-follow tooltip is opened by the focus event, it could revert to fixed placement on the element (not following the cursor).

To be honest I don't like either of these solutions. Simply ignoring keyboard events for mouse-follow cursors effectively removes functionality for users that navigate with the keyboard. And falling back to a fixed tooltip for keyboard events not only ignores the developers explicit configuration settings, but has the chance to produce unwanted/unexpected tooltip placement, especially when used on links that open a new tab or window.

Next steps

I'll think on this problem and see if I can come up with another solution.

If anyone reading this has any suggestions I would greatly appreciate hearing your thoughts.

stevenbenner avatar Sep 30 '12 07:09 stevenbenner