Skip to content

Fix #6137, dialog('open') causes form elements to reset on IE7. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jfirebaugh
Copy link

See http://dev.jqueryui.com/ticket/6137 and commit message for details.

Looking through the history, the behavior of appending to the body was
present in the initial commit without explanation. The only substantive
change thereafter was adding the next().length check in fbdb9f0,
fixing #3012.

uiDialog is already appended to the body in _create, and doing it again
in open seems only to cause problems. Removing it does not cause any
test regressions.
@scottgonzalez
Copy link
Member

I'm pretty sure the IE6 thing is a myth. Dialogs are appended to the end of the body to ensure the z-index works as expected (by avoiding nested stacking contexts) in all browsers. It's entirely possible that there's some bug in IE6 that we're trying to avoid, but changing positions within the same parent isn't it.

I'm almost positive that this code used to just blindly append the dialog to the body. Somebody complained, filed a ticket, gave a decent reason why we didn't need to do that and we went with something more conservative, which is what we have today. I believe the reasoning was that we can assume the dialog is already a direct child of the body (because we put it there) and therefore we can just worry about the one thing we're actually concerned with, which is making it the last child. However, as I've said, this isn't a real problem. In fact, if it were, the moveToTop method would be broken as all it does is change z-indexes.

I think it's safe to land this patch.

@scottgonzalez
Copy link
Member

I just put together a test page with two dialogs with the three lines commented out. The following occurs in the test:

  • open dialog 1 (dialog 1 is now last child of body - moved on create)
  • open dialog 2 (dialog 2 is now last child of body - moved on create)
  • close both dialogs (dialog 2 is still last child of body)
  • open dialog 2 (dialog 2 is still last child of body)
  • open dialog 1 (dialog 2 is still last child of body)

Dialog 1 appears on top of dialog 2, even though it comes earlier in the DOM. Clicking on dialog 2 brings it to the front, then clicking on dialog 1 brings it to the front.

@scottgonzalez
Copy link
Member

Heh, while I was committing your fix, I saw your full commit message which explained the history that I was trying to recall from memory :-)

Thanks for digging into this and fixing it.

Landed in e66cdfc.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants