Skip to main content

Search and Top Navigation

#9273 closed bug (notabug)

Opened May 06, 2013 01:17PM UTC

Closed May 07, 2013 01:36PM UTC

Last modified May 07, 2013 02:01PM UTC

Dialog: the "appendTo" option should move the overlay if any

Reported by: paftek38 Owned by: paftek38
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

Changing the "appendTo" option on the fly moves only the dialog, not its overlay.

Attachments (0)
Change History (10)

Changed May 06, 2013 01:43PM UTC by scottgonzalez comment:1

owner: → paftek38
status: newpending

By on the fly, do you mean while open?

Changed May 06, 2013 03:24PM UTC by paftek38 comment:2

status: pendingnew

Yes.

Changed May 06, 2013 03:36PM UTC by scottgonzalez comment:3

status: newpending

Why are you changing the option while the dialog is open?

Changed May 06, 2013 08:41PM UTC by paftek38 comment:4

status: pendingnew

Replying to [comment:3 scott.gonzalez]:

Why are you changing the option while the dialog is open?

The widgets are automatically instanciated in my complex app. I need to move the dialog after that to solve a z-index issue. So I am doing something like :

$('#my_dialog').dialog('option', 'appendTo', target);

Problem: the overlay is not moved into "target".

Could the following solve the problem in _setOption()?

if ( key === "appendTo" ) {
    this.uiDialog.appendTo( this._appendTo() );
    if ( this.overlay) {
        this.overlay.appendTo( this._appendTo() );
    }
}

Changed May 07, 2013 01:13AM UTC by scottgonzalez comment:5

status: newpending

Replying to [comment:4 paftek38]:

The widgets are automatically instanciated in my complex app. I need to move the dialog after that to solve a z-index issue.

That doesn't explain why you're doing this while the dialog is open, instead of before opening the dialog. Why can't you set the option before opening the dialog?

Could the following solve the problem in _setOption()?

You'd need to do more than that. But if we change this, then we need to write a test for it. And I'd prefer not to do that because this is one of those things that you really shouldn't be doing.

Changed May 07, 2013 07:32AM UTC by paftek38 comment:6

status: pendingnew

Replying to [comment:5 scott.gonzalez]:

That doesn't explain why you're doing this while the dialog is open, instead of before opening the dialog. Why can't you set the option before opening the dialog?

I have my reasons to do that, I could probably do it differently but I think this is not the point.

Why should _setOption() allow to modify the appendTo option if it does half the job? If it is too hard to move the overlay while the dialog is open, we should probably prevent the appendTo option to be modified.

Changed May 07, 2013 12:04PM UTC by scottgonzalez comment:7

status: newpending

Replying to [comment:6 paftek38]:

I have my reasons to do that, I could probably do it differently but I think this is not the point.

It very much is the point. If you want something to work, you'll need to provide a valid use case.

Why should _setOption() allow to modify the appendTo option if it does half the job? If it is too hard to move the overlay while the dialog is open, we should probably prevent the appendTo option to be modified.

We're not going to write code to check if you're doing something that you shouldn't do. You need to provide a valid reason why you need to move the dialog while it's open if you want the behavior to change.

Changed May 07, 2013 01:28PM UTC by paftek38 comment:8

status: pendingnew

Replying to [comment:7 scott.gonzalez]:

We're not going to write code to check if you're doing something that you shouldn't do. You need to provide a valid reason why you need to move the dialog while it's open if you want the behavior to change.

You want to see it live? Here it is (with comments inside): http://jsfiddle.net/4KHmB/2/

Changed May 07, 2013 01:36PM UTC by scottgonzalez comment:9

resolution: → notabug
status: newclosed

So you've built an app that doesn't do what you want. The best option is to fix your app to suit your needs, but you've said that's not an option... The next best option is to work around it in your code, since what you're working around is your own app... Just close the dialog, set the option, re-open the dialog: http://jsfiddle.net/4KHmB/3/

We're not going to change this behavior in jQuery UI, because there is no reasonable use case in which the option should change while already open.

I'll add a note to the docs to make this clear.

Changed May 07, 2013 02:01PM UTC by paftek38 comment:10

Replying to [comment:9 scott.gonzalez]:

So you've built an app that doesn't do what you want. The best option is to fix your app to suit your needs, but you've said that's not an option...

Next time I would appreciate not to be treated like a fool.

You do not want to accept or understand the context of my problem ? Fine. You do not want to accept or understand that my app interacts with an external app and that I cannot have access to every step of the process ? Fine.

We're not going to change this behavior in jQuery UI, because there is no reasonable use case in which the option should change while already open.

If you want to be perfectly reasonable please prevent the _setOption('appendTo', ...) to do anything while the dialog is open.

Because moving the dialog without moving its overlay is absurd IMHO.