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

Centered addon: Invisible portions of overflowing components are inaccessible #1225

Closed
su-narthur opened this issue Jun 8, 2017 · 9 comments

Comments

@su-narthur
Copy link
Contributor

su-narthur commented Jun 8, 2017

When using the Centered addon, portions of a component which overflow the preview window are inaccessible.

Adding overflow: scroll; to the wrapper Centered creates allows for accessing the bottom inaccessible portion, but not the top inaccessible portion due to this issue with flexbox.

Adding margin: auto; to an inner wrapper immediately inside the one Centered now creates seems to fix the issue without affecting the centering of components which completely fit. See this explanation of the fix and this demo.

I blindly edited the addon's src/index.js file and came up with the following, though I'm new to the js development world and so didn't know how to compile it in order to test the fix:

import React from 'react';

const style = {
  position: 'fixed',
  top: 0,
  left: 0,
  bottom: 0,
  right: 0,
  display: 'flex',
  alignItems: 'center',
  justifyContent: 'center',
  overflow: 'auto',
};

const innerStyle = {
  margin: 'auto',
}

export default function(storyFn) {
    return <div style={style}><div style={innerStyle}>{storyFn()}</div></div>;
}

Can this fix be added to the addon?

@ndelangen ndelangen added this to the v3.0.2 milestone Jun 8, 2017
@ndelangen
Copy link
Member

Do you see an opportunity to open a PR to fix this @su-narthur ?

@su-narthur
Copy link
Contributor Author

@ndelangen Absolutely, this would be better as a PR. I hesitated, since I didn't know how to test my fix. Go for it anyway?

@ndelangen
Copy link
Member

Go for it, I can help you test if you'd like.

My schedule for tomorrow will only allow me to be available after 17:30 CEST though.

su-narthur added a commit to su-narthur/storybook that referenced this issue Jun 9, 2017
Add CSS to allow for oversized components to scroll in all directions. See [issue storybookjs#1225](storybookjs#1225 (comment)).
@su-narthur
Copy link
Contributor Author

@ndelangen Ok, I've created a PR. What's next?

@ndelangen
Copy link
Member

Thank you! I'll review and test it! 👍

@shilman shilman modified the milestones: v3.1.2, v3.1.3, v3.1.4 Jun 9, 2017
@ndelangen
Copy link
Member

Merged!

@casvil
Copy link

casvil commented Mar 29, 2019

overflow-x does not work.

I am developing a case which I have a table with fixed column widths. When the table does not fit the container or whatever is placed in, it won't overflow and scroll horizontally.

The inner div style innerStyle needs as well to have the property overflow: 'auto' .
I'd like to contribute with a PR

@kevinsar
Copy link

kevinsar commented Jul 8, 2019

@casvil I can confirm that I am still seeing this bug in storybook 5.x.x, did you happen to come up with a fix?

@casvil
Copy link

casvil commented Jul 9, 2019

hey @kevinsar , it was merged in #6361 but removed later in #6862. Sad

You can create your own custom decorator with overflow: auto being set

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

No branches or pull requests

5 participants