Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9364 closed bug (fixed)

Dialog: Click of element with tooltip scrolls the dialog to the top

Reported by: thojon Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.dialog Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:


See this fiddle:

Clicking the link at the bottom in the dialog works the first time (in my case, a div is toggled) but after the first time it doesn't work, the scrollbar moves to top and nothing happens. The scenario only arises when you have tooltip on ths js-link and you have a link at top of the page and that the js link you click is not shown from start, eg you have to scroll down to click it.

It works correctly in jquery ui 1.9.2

Change History (8)

comment:1 Changed 4 years ago by tj.vantoll

Component: ui.coreui.dialog
Status: newopen
Summary: Tooltip on js link in dialog messes up js callDialog: Click of element with tooltip scrolls the dialog to the top

I'm still not exactly sure what's going on here but I could recreate the problem. Reduced:

  • The behavior changed per the dialog rewrite in 1.10.
  • The behavior only occurs when a tooltip is placed on the link.

Not only is a click event not occurring on the tooltip, click events seem to be completely suppressed. $( document ).on( "click", function() {} ) never fires.

comment:2 Changed 4 years ago by Anna

The problem is in the function '_moveToTop'.

For some reason it runs on each click inside a dialog. If it finds any visible elements behind the dialog, it moves them above the dialog and scrolls the dialog to top. But the tooltip is simply added to the body right after the dialog and it is visible when you click on the element with it.

For me, the issues is fixed by preventing the _moveToTop function launching for tooltips. But I think it will not help if some custom tooltips or elements will be added.

comment:3 Changed 4 years ago by seppo.savolainen

I encountered the same problem. Can you dirty fix this by overriding _moveToTop of the Dialog like this:

_moveToTop: function (event, silent) {

var moved = !!this.uiDialog.nextAll(":visible:not(.ui-tooltip)").insertBefore( this.uiDialog ).length;

if ( moved && !silent ) {

this._trigger( "focus", event );


return moved;


I added :not(.ui-tooltip) to the selector, so _moveToTop doens't consider tooltips as other dialogs.

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

Just tested this with my fix for #9166 in place (see It works as intended, since the DOM shuffling is gone. Can this be considered a duplicate of #9166? The underlying issue is the same, even if the symptoms are different.

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

I think this is sufficiently different enough to not close a duplicate. But it should be closed by that PR, so let's update the commit message before landing.

comment:6 Changed 4 years ago by Jörn Zaefferer

Resolution: fixed
Status: openclosed

Dialog: Switch back to shuffling z-index, but only look at .ui-front siblings.

Fixes #9166 - Dialog: moveToTop implementation resets flash/video/iframe/scroll Fixes #9364 - Dialog: Click of element with tooltip scrolls the dialog to the top

Changeset: e263ebda99f3d414bae91a4a47e74a37ff93ba9c

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

Milestone: none1.11.0

comment:8 Changed 4 years ago by tj.vantoll

#9591 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.