#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: |
Description
See this fiddle: http://jsfiddle.net/jYXcQ/39/
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 10 years ago by
Component: | ui.core → ui.dialog |
---|---|
Status: | new → open |
Summary: | Tooltip on js link in dialog messes up js call → Dialog: Click of element with tooltip scrolls the dialog to the top |
comment:2 Changed 10 years ago by
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 9 years ago by
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 9 years ago by
Just tested this with my fix for #9166 in place (see https://github.com/jquery/jquery-ui/pull/1090). 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 9 years ago by
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 9 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
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 9 years ago by
Milestone: | none → 1.11.0 |
---|
I'm still not exactly sure what's going on here but I could recreate the problem. Reduced: http://jsfiddle.net/tj_vantoll/WWraV/
Not only is a click event not occurring on the tooltip, click events seem to be completely suppressed.
$( document ).on( "click", function() {} )
never fires.