Skip to main content

Search and Top Navigation

#15051 open bug ()

Opened September 23, 2016 06:41PM UTC

Last modified September 29, 2016 05:48PM UTC

no callback for tooltip shown with a delay

Reported by: jason-s Owned by:
Priority: blocker Milestone: 1.13.0
Component: ui.tooltip Version: 1.11.3
Keywords: Cc:
Blocked by: Blocking:
Description

There is the open() event callback for the tooltip widget but it gets called immediately when there is a trigger to open the tooltip. In my case I need to use a show: {delay: 500} to delay 500ms, and execute a callback when the tooltip is actually shown. There appears to be no way to do this with the existing version of code.

I'm looking at jquery.widget._show() and it does provide a callback, but the tooltip widget does not use this:

(from https://github.com/jquery/jquery-ui/blob/master/ui/widgets/tooltip.js#L322)

		this._show( tooltip, this.options.show );

		// Handle tracking tooltips that are shown with a delay (#8644). As soon
		// as the tooltip is visible, position the tooltip using the most recent
		// event.
		// Adds the check to add the timers only when both delay and track options are set (#14682)
		if ( this.options.track && this.options.show && this.options.show.delay ) {
			delayedShow = this.delayedShow = setInterval( function() {
				if ( tooltip.is( ":visible" ) ) {
					position( positionOption.of );
					clearInterval( delayedShow );
				}
			}, $.fx.interval );
		}

		this._trigger( "open", event, { tooltip: tooltip } );

Not sure what the change should be, but there ought to be some way to provide a callback function that is triggered when the tooltip is actually shown. (should open() get called later? should there be an _open() event as well? should the show options include a callback that is called when the show operation is complete?)

Attachments (0)
Change History (1)

Changed September 29, 2016 05:48PM UTC by scottgonzalez comment:1

component: ui.coreui.tooltip
milestone: none1.13.0
priority: minorblocker
status: newopen

To deal with this, we need to rename the existing open event to beforeOpen and add a new open event after _show() completes. This can't happen until 1.13.0 since it's a breaking change. We also need to update dialog to match.