8000 Prevent overflow content from being hidden after collapse open by meriadec · Pull Request #166 · nkbt/react-collapse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Prevent overflow content from being hidden after collapse open #166

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

Merged
merged 2 commits into from
Jul 30, 2017
Merged

Prevent overflow content from being hidden after collapse open #166

merged 2 commits into from
Jul 30, 2017

Conversation

meriadec
Copy link
Contributor
@meriadec meriadec commented Apr 20, 2017

EDIT outdated: removed the """fix"""

Related to #163.

This commit prevent setting overflow: hidden when a new render occur, and the isOpened prop is still the same (because Collapse move to WAITING state). Now, it pass to WAITING only if isOpened has changed. To explain better here is an animated explanation of the problem:

before:
before

after:
after

I didn't understand the reason why the state is reset to WAITING either isOpened OR nextProps.isOpened is true, so correct me if I break something.

Thanks for the package, by the way! 😄

Copy link
Owner
@nkbt nkbt left a comment

Choose a reason for hiding this comment

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

It is hard to say without carefully checking every example on examples page (or npm start). These state changes were carefully tweaked to male everything work and even this small change may easily break third of all cases :(.

Sorry for missing your point on the issue and closing it too early and thanks for your time debugging and doing PR. I will give it a good test asap

Lots of these problems should go away and code would be way simpler when I switch from react-motion to something less react specific. But I don't have much time to do it at the moment

@meriadec
Copy link
Contributor Author

No prob, those kinds of cases are hard to explain with only words, and pretty rare too.
If I can help in something to ensure there is no regression, please let me know :)

@danielbush
Copy link

Hitting this one too - our dropdowns are getting clipped because uncollapsed widget goes into WAITING after the parent component re-renders. Anyway thanks for doing this p/r, hope it gets accepted soon.

@nkbt
Copy link
Owner
nkbt commented May 3, 2017

Thanks for ping, I need to do some more checks... One day I may even write tests for this stuff lol

@endenwer
Copy link
endenwer commented May 5, 2017

I have the same problem and this solution worked as a charm. Thanks.

@nkbt
Copy link
Owner
nkbt commented May 5, 2017

It actually breaks quite important bit of functionality

How it works on master branch

collapse-pr166-master

How it works in pr/166

collapse-pr166

@meriadec
Copy link
Contributor Author
meriadec commented May 5, 2017

Yep, that's not good. To handle both cases, we need to figure a way to keep animation + overflow hidden when content is added (when height change?), and don't launch animation when not (when whatever happen that trigger a re-render).

So, I'm gonna remove the changes, and add an example in the demos.

@nkbt
Copy link
Owner
nkbt commented May 5, 2017

Thanks @meriadec!

@meriadec
Copy link
Contributor Author
meriadec commented May 5, 2017

Here it is.
So the goal is to find a way to not put overflow hidden when not needed.

overflow

@nkbt
Copy link
Owner
nkbt commented May 5, 2017

But it gets to overflow:auto after animation is finished... (or it is gif new round?)

By the way, I reckon things like popovers should be outside of containers and attached to body, since you cannot override that overflow thing. Alternatively you can probably set position:fixed to the content + z-index, so it will effectively be rendered outside of overlow:hidden block

@meriadec
Copy link
Contributor Author
meriadec commented May 5, 2017

It gets to overflow: auto when animation is finished, which is totally fine.
The problem is when it set overflow: hidden when another render occurs (in my example when I toggle Overflow opened), and that overflow hidden is never put back to auto.

@meriadec
Copy link
Contributor Author
meriadec commented May 5, 2017

Maybe the gif looping make things not clear

@meriadec
Copy link
Contributor Author
meriadec commented May 5, 2017

Ok. Another try, here the WAITING state is put back to IDLING if not being catched by this line.

It seems to solve the problem, and not breaking other examples 😄
overflow-2

What do you think?

@meriadec meriadec changed the title Prevent set WAITING state if isOpened doesnt change Prevent overflow content from being hidden after collapse open May 5, 2017
@roopemerikukka
Copy link

Yep there seems to be a problem with the overflow getting hidden state when re-render happens while the isOpened state doesn't change from true to false.

@meriadec
Copy link
Contributor Author

@nkbt did you had time to test it? Seems to not break any other demos this time 😄

@sarukuku
Copy link

I'm also waiting for this to get merged & released!

@sarukuku
Copy link
sarukuku commented May 31, 2017

@nkbt would you have time to check this? There are a few waiting. :)

@nkbt nkbt mentioned this pull request Jun 16, 2017
@selbekk
Copy link
selbekk commented Jun 20, 2017

+1 here as well.

Edit: By the way, this works just fine on the ^2.x branch, so if you need this functionality, that version might help you.

nutgaard added a commit to navikt/aksel that referenced this pull request Jun 23, 2017
Pga nkbt/react-collapse#166
`Overflow: hidden` blir satt ved rerender selvom state til collapse
ikke endrer seg.
vartija added a commit to Opetushallitus/henkilo-ui that referenced this pull request Jun 28, 2017
vartija added a commit to Opetushallitus/henkilo-ui that referenced this pull request Jun 29, 2017
@timlindeberg
Copy link

Any progress on this issue? Would love to see a fix for this.

@jameskraai
Copy link

This fix would be perfect

@bbatsche
Copy link

This would be pretty excellent to have in my company's projects.

Copy link
@bbatsche bbatsche left a comment

Choose a reason for hiding this comment

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

Looks great!

@monteiz
Copy link
monteiz commented Jul 17, 2017

I was experiencing what also @roopemerikukka noticed, that is the overflow was switched again to hidden after a re-render.

The #181 works for me.

@nkbt nkbt merged commit 3cf3f30 into nkbt:master Jul 30, 2017
@nkbt
Copy link
Owner
nkbt commented Jul 31, 2017

Published react-collapse@4.0.3

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.

0