Opened 10 years ago

Closed 10 years ago

#8982 closed bug (wontfix)

Dialog containment should be reset when using new "appendTo" option

Reported by: raybellis Owned by:
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:


If a dialog is moved outside of its default position to an alternate element using the new "appendTo" option then the dialog's containment should be reset to that new element.

This is similar to #5699, except that now that there's an officially supported method of reparenting a dialog I think the user should expect jQueryUI to "do the right thing" automatically.

My generic code to reparent a dialog now looks like this:

            var $this = $(this);
            var o = $this.dialog('option');
            if (!o.modal) {
                $this.dialog('option', 'appendTo', $wm);

                var $p = $this.parent();
                if (o.draggable) {
                    $p.draggable('option', 'containment', 'parent')

                if (o.resizable) {
                    $p.resizable('option', 'containment', 'parent');

which is IMHO needlessly complicated (and requires knowledge of jQueryUI internals that most developers don't need) when this logic should be inside the plugin.

Change History (1)

comment:1 Changed 10 years ago by Scott González

Resolution: wontfix
Status: newclosed

No, that's custom behavior. People generally need the appendTo option to preserve context for things like forms. You're actually not using any internals in that code, only public APIs.

Note: See TracTickets for help on using tickets.