Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#8646 closed bug (fixed)

Tooltip: Delegated tooltips don't close when the tooltipped element is removed

Reported by: josepsanzcamp Owned by: acouch
Priority: minor Milestone: 1.9.1
Component: ui.tooltip Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:

Description

I have a page that contain some elements with title attribute and the tooltip works as expected, but sometimes, when I replace the content that contain the tooltip launcher between the show and hide event, the hide event never is executed and the tooltip is attached to the screen. Currently, I hide all .ui-tooltip elements to prevent this issue when I replace the content.

Change History (17)

comment:1 Changed 7 years ago by Scott González

Owner: set to josepsanzcamp
Status: newpending

Please provide a reduced test case showin the situation that you're describing.

comment:2 Changed 7 years ago by brendandc

I am seeing the same issue, here is a reduced test case:

http://jsfiddle.net/CNDq6/1

comment:3 Changed 7 years ago by Scott González

Status: pendingopen

I had a feeling this was about delegated tooltips. Perhaps we can bind temporary remove event handlers for open delegated tooltips.

comment:4 Changed 7 years ago by Scott González

Summary: Tooltip never close when the launcher object is replaced.Tooltip: Delegated tooltips don't close when the tooltipped element is removed

comment:5 Changed 7 years ago by acouch

Owner: changed from josepsanzcamp to acouch
Status: openassigned

comment:6 Changed 7 years ago by acouch

Resolution: fixed
Status: assignedclosed

comment:7 Changed 7 years ago by Jörn Zaefferer

Stupid track, that commit didn't land yet.

Version 0, edited 7 years ago by Jörn Zaefferer (next)

comment:8 Changed 7 years ago by Jörn Zaefferer

Resolution: fixed
Status: closedreopened

comment:9 Changed 7 years ago by Jörn Zaefferer

Status: reopenedopen

Or did acouch just close the ticket manually? Can't tell.

comment:10 Changed 7 years ago by acouch

yes, manually closed per suggestion from another at my table.

it's in pull request https://github.com/jquery/jquery-ui/pull/751

comment:11 Changed 7 years ago by Scott González

#8683 is a duplicate of this ticket.

comment:12 Changed 7 years ago by dsargent@…

How is this a minor priority? It makes tooltips useless if you want to use an AJAX call to load the data. Is there currently a known work around?

comment:13 Changed 7 years ago by acouch

@dsargent - from the op: "Currently, I hide all .ui-tooltip elements to prevent this issue when I replace the content."

They could also be safely removed with a simple $( ".ui-tooltip" ).remove() just before or after replacing the content.

comment:14 in reply to:  13 ; Changed 7 years ago by dsargent@…

Doesn't help. My problem may not be completely related to this bug, but I'm not sure. In my case I have tooltips attached to links in a dialog, the contents of the tooltip are being populated via an AJAX call, if you click the link it does not fire an event (return false) but this causes the tooltip to stay open. I've added your suggestion to the close event of the dialog box, if you then close the dialog box the tooltip disappears and then reappears in the top right corner of the screen with a different ID. Something is recreating the silly things! I've also tried: $('.ui-tooltip').hide(); $('.ui-tooltip').tooltip('destroy'); etc. No matter what I do in the dialog close event, the tooltip is recreated a split second after the dialog closes . . . I've replicated this with jsFiddle here http://jsfiddle.net/H34rr/ To make it happen do the following. Hover over the link in the dialog, the tooltip should appear. Press Escape key on the keybaord to close the dialog.

Note: I've discovered the hide animation seems to be helping to cause the problem.

Any clue on how I can fix this short term. If I had hair I'd be pulling it out about now :)

Replying to acouch:

@dsargent - from the op: "Currently, I hide all .ui-tooltip elements to prevent this issue when I replace the content."

They could also be safely removed with a simple $( ".ui-tooltip" ).remove() just before or after replacing the content.

comment:15 Changed 7 years ago by Scott González

#8704 is a duplicate of this ticket.

comment:16 Changed 7 years ago by Andrew Couch

Resolution: fixed
Status: openclosed

Tooltip: handle removal of elements with delegated tooltips. Fixed #8646 - Delegated tooltips don't close when the tooltipped element is removed

Changeset: 3b2d1e7736be99671af70aa3b775d67b917517e5

comment:17 in reply to:  14 Changed 7 years ago by acouch

I was able to get rid of the issue by upgrading jQuery UI to 1.9.1.

Replying to dsargent@…

Note: See TracTickets for help on using tickets.