Skip to content

Commit f2a9deb

Browse files
committed
Dialog: Prevent the titlebar from displaying above the top of the document.
Fixes #5141 - Position of Dialog is off the page when viewport is smaller then dialog.
1 parent 267e978 commit f2a9deb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ui/jquery.ui.dialog.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,14 @@ $.widget("ui.dialog", {
445445
at: myAt.join(' '),
446446
offset: offset.join(' '),
447447
of: window,
448-
collision: 'fit'
448+
collision: 'fit',
449+
// ensure that the titlebar is never outside the document
450+
using: function(pos) {
451+
var topOffset = $(this).css(pos).offset().top;
452+
if (topOffset < 0) {
453+
$(this).css('top', pos.top - topOffset);
454+
}
455+
}
449456
});
450457
if (!isVisible) {
451458
this.uiDialog.hide();

0 commit comments

Comments
 (0)