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 improvements #810

Merged
merged 4 commits into from
Jun 15, 2015
Merged

Modal improvements #810

merged 4 commits into from
Jun 15, 2015

Conversation

jquense
Copy link
Member

@jquense jquense commented Jun 10, 2015

First few bits of getting the Modal logic up to par with upstream tbs. No breaking changes, no major api rewrites...yet

@AlexKVal
Copy link
Member

the header of the third commit: no no longer
[fixed] container content no no longer shifts when overflowing

@mtscout6 mtscout6 added this to the 1.0.0 Release milestone Jun 11, 2015
@taion
Copy link
Member

taion commented Jun 11, 2015

This will resolve #354, BTW.

@@ -1,5 +1,13 @@
import React from 'react';


let canUseDom = !!(
Copy link
Member

Choose a reason for hiding this comment

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

should that be a const?

@taion
Copy link
Member

taion commented Jun 11, 2015

And #723, I believe. Very nice.

function onFocus(context, handler) {
let doc = domUtils.ownerDocument(context);
let useFocusin = !doc.addEventListener
, remove;
Copy link
Member

Choose a reason for hiding this comment

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

In generall we haven't been following a single var pattern in this library. For consistency can this just be another let definition. Webpack Uglify plugin should reduce it to single var in the optimized bundle.

@mtscout6
Copy link
Member

This all looks really good, minor style tweaks from single var pattern for consistency and it should be ready to go.

@jquense
Copy link
Member Author

jquense commented Jun 13, 2015

I will make that change :) there is one thing that bothers me here that I don't know how to fix given the current way overlays work.

.modal-open is removed on componentWillUnmount, which should be the same thing as "Modal is closed" but given how the FadeMixin works it doesn't actually mean that, since there is now a cloned element in the DOM mascarading as the modal Component, this leads to the body class being removed too quickly, and the screen "jumps" during that 300ms transition.

Generally I have solved things like this by creating something like the TransitionGroup addon that will keep a component child mounted (by caching it in state) until the transition completes, and then unmounts, but I am not sure that would work here, since the Overlay's don't ask the component if they should be rendered or not.

@mtscout6
Copy link
Member

Latest CI failures should resolve if you rebase on the latest master

Correctly pads the modal to account for the container having a scroll
bar
Allows you to configure whether the modal should enforce focus when
open. Ideally this doesn't need to be a public API, but in the case of
static models (like in the docs) you need to turn it off, because you
can't assume its the only one open on the page.
Incorporates upstream tbs logic to pad the container before hiding the
scrollbar with the `.modal-open` class

fixes #354
@mtscout6
Copy link
Member

@jquense Is that concern something you are considering in #811? Or is it blocking this PR from getting resolved?

@jquense
Copy link
Member Author

jquense commented Jun 13, 2015

@mtscout6 I don't think it blocks this PR, just noting a known limitation to the fix here that doesn't bring it completely inline with upstream bootstrap. I 'd be happy to fix it before we merge if anyone can help figure out a simple way to address it, otherwise we can revisit when #810 is done.

One thought was just to have FadeMixin call an optional callback when it has faded out, but I wasn't quite sure how to safely implement that without breaking compat

@mtscout6
Copy link
Member

I'd say this is a smaller scoped problem that can be solved in another issue.

};
},

getInitialState(){
return { };
Copy link
Member

Choose a reason for hiding this comment

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

empty ?
itsn't it the same as there is no getInitialState() at all ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is pretty much the same yeah, with one useful difference: providing an empty object lets you access properties on it for a falsey value instead of an error (Null Exception)

// without the empty object in getInitialState this would throw the first render
var style = this.state.dialogStyles // state is null

I could be slightly more correct and set state to { dialogStyles: undefined } but it seems unneeded

Copy link
Member

Choose a reason for hiding this comment

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

Ah.. I see.. I should try it myself. Remove it and see what's happening. 😊

@mtscout6
Copy link
Member

LGTM

Is there anything else preventing this from getting merged today?

@jquense
Copy link
Member Author

jquense commented Jun 15, 2015

not that I know of :)

@dozoisch
Copy link
Member

:shipit:

mtscout6 added a commit that referenced this pull request Jun 15, 2015
@mtscout6 mtscout6 merged commit 6c7a5f0 into master Jun 15, 2015
@mtscout6 mtscout6 deleted the modal-improvements branch June 15, 2015 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants