Skip to content
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

Modal: Fix backdrop not readjusting when height changes #15881

Merged
merged 1 commit into from Mar 3, 2015

Conversation

hnrch02
Copy link
Collaborator

@hnrch02 hnrch02 commented Feb 24, 2015

Fixes #15136.
Closes #15345.
Closes #15314.
Refs #14724, #14927.

Effectively reverts #14724 but still fixes #13816. The backdrop will now again be appended to the body and not the .modal container.
Also includes a workaround for when an opening accordion makes the modal overflow to minimize jumping on the dialog. (It's more of a proof of concept, I understand if we take it out before merging.)

/cc @cvrebert @fat @XhmikosR

Sorry it took so long guys.

@cvrebert
Copy link
Collaborator

How does this fix #15106 exactly? handleUpdate() is still undocumented.

@DaSchTour
Copy link
Contributor

I thought handleUpdate() wouldn't be necessary anymore?

kkirsche pushed a commit to kkirsche/bootstrap that referenced this pull request Feb 24, 2015
…c content height

Fixes twbs#15106 — Document how to properly handle modals with dynamic content height

X-Ref: twbs#15881
@hnrch02
Copy link
Collaborator Author

hnrch02 commented Feb 25, 2015

To clarify: handleUpdate is no longer needed to adjust the height of the backdrop, it now only centers the modal by applying padding when the modal is overflowing. So you'd only need to call it if the height change made the modal display a scrollbar when it before didn't have one. That's not a new problem though, it's been around for much longer.

@@ -167,7 +167,7 @@ $(function () {
assert.notEqual($('#modal-test').length, 0, 'modal insterted into dom')
$('.contents').click()
assert.ok($('#modal-test').is(':visible'), 'modal visible')
$('#modal-test .modal-backdrop').click()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive my confusion, but why isn't this $('.modal-backdrop').click()? Isn't clicking on the backdrop rather than the modal itself the whole point of this test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you'll never click on the backdrop. The event listener for the click event is on the modal element.

kkirsche pushed a commit to kkirsche/bootstrap that referenced this pull request Feb 25, 2015
[Ref twbs#15881] Use Explicit Values for javascript variables rather than chained ones.

From twbs#15881 (comment)
hnrch02 added a commit that referenced this pull request Feb 26, 2015
[Ref #15881] Use Explicit JS Variable Declarations rather than Chained
@cvrebert
Copy link
Collaborator

cvrebert commented Mar 2, 2015

While #15910 did add a note about needing to call handleUpdate(), the API docs are still missing an entry for it.

@hnrch02
Copy link
Collaborator Author

hnrch02 commented Mar 2, 2015

True, but since handleUpdate can't be called with the string argument to $.fn.modal it would be kinda out of place there.

@@ -64,6 +66,28 @@
this.resize()

this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$element.on('show.bs.collapse hide.bs.collapse', function (e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like this is making a bloated method, worse – can we move some of this logic into a handler

maybe like

this.$element.on('show.bs.collapse hide.bs.collapse', this.adjustDialogOnShowHide)

or some better name 👍

@fat
Copy link
Member

fat commented Mar 3, 2015

lgtm

hnrch02 added a commit that referenced this pull request Mar 3, 2015
Modal: Fix backdrop not readjusting when height changes
@hnrch02 hnrch02 merged commit 200f6fb into master Mar 3, 2015
@hnrch02 hnrch02 deleted the fix-modal-backdrop branch March 3, 2015 04:54
@cvrebert
Copy link
Collaborator

cvrebert commented Mar 3, 2015

True, but since handleUpdate can't be called with the string argument to $.fn.modal it would be kinda out of place there.

@hnrch02 I think that's an oversight in and of itself. We don't intentionally make folks jump through the .data('bs.foo') hoop with anything else...

@hnrch02
Copy link
Collaborator Author

hnrch02 commented Mar 3, 2015

@cvrebert So you suggest we add $().modal('handleUpdate')?

@cvrebert
Copy link
Collaborator

cvrebert commented Mar 3, 2015

Yeah.

@hnrch02
Copy link
Collaborator Author

hnrch02 commented Mar 3, 2015

It is actually already accessible that way, we just need to document it.

@DaSchTour
Copy link
Contributor

So when can we expect 3.3.4?

@mdo
Copy link
Member

mdo commented Mar 29, 2015

Looks like the CSS changes here caused #16148. Are they necessary?

@allspain
Copy link

allspain commented Apr 7, 2015

so is there a fix for this & #16148 being worked on?

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 7, 2015

@allspain "This" is a pull request, so it's not clear what problem you're referring to.

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 7, 2015

@hnrch02 Can you answer mdo's question?

@allspain
Copy link

allspain commented Apr 7, 2015

Sorry I was referring @mdo 's question, and the bug (#16148) this pull request may have introduced. Should have been more concise.

@hnrch02
Copy link
Collaborator Author

hnrch02 commented May 8, 2015

@mdo Just wanna follow up here: I merely reverted the CSS to the pre 3.3.0/#15136 state. #16148 is a problem that exists since at least v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
8 participants