It's for window only not applied to dialog isn't it ?
I replace the window to dialog and it works good.
$.extend($.fn.dialog.methods, {
constrain: function (jq) {
return jq.each(function () {
var target = this;
var state = $(target).data('window');
$(target).dialog('dialog').draggable({
....