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

Chip element goes full-width in MS Edge #9615

Closed
1 task done
IBestuzhev opened this issue Dec 26, 2017 · 9 comments
Closed
1 task done

Chip element goes full-width in MS Edge #9615

IBestuzhev opened this issue Dec 26, 2017 · 9 comments
Labels
bug 🐛 Something doesn't work component: chip This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@IBestuzhev
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

When using the Chip element, behavior differs in browser. While in Chrome it has width calculated based on label and avatar, in MS Edge the element is 100% width. I did a CodeSandbox snippet to reproduce it.

Expected Behavior

The Chip should be as narrow as its content, like it does in Chrome

Current Behavior

On MS Edge (versions: Microsoft Edge 41.16299.15.0; Microsoft EdgeHTML 16.16299) the Chip element is full width

Steps to Reproduce (for bugs)

  1. CodeSandbox snippet
  2. Add a Chip element to App
  3. The rendering differs in Chrome and Edge
  4. Wrapping Chip with inline-flex container (e.g. Badge or custom div) fixes an issue.

Context

I'm rendering a statistic page, where Avatar shows ID and label displays aggregation data. I show each chip on new line (in a narrow Grid element) so it's not a big problem, but in this case Avatar is not left-most.

Your Environment

Tech Version
Material-UI 1.0.0-beta.24
React 16.2
browser Edge
Microsoft Edge 41.16299.15.0
Microsoft EdgeHTML 16.16299
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: chip This is the name of the generic UI component, not the React module! labels Dec 26, 2017
@oliviertassinari
Copy link
Member

Cc @mbrookes

@IBestuzhev
Copy link
Author

I take a look at styles and see that Chip Element has width: fit-content. But intrinsic-width properties are not supported by MS: caniuse and Edge dev site. It's under consideration with low priority.

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Dec 26, 2017
@oliviertassinari oliviertassinari added this to the v1.0.0 milestone Dec 26, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 26, 2017

@IBestuzhev What do you think of removing fit-content and using display: inline-flex? I do think that it should be the default behavior given the context the component will most likely be used in.

@IBestuzhev
Copy link
Author

@oliviertassinari I discovered this fix as I have some Chips wrapped in Badge. But looks like it works even if applied to Chip itself, without wrapping:

<Chip label="Fix no wrapped" avatar={<Avatar>{3}</Avatar>} style={{display: "inline-flex"}} />

I think it's OK. The chip element is inline by design, so this solution looks natural.
I hope it does not break other cases.

@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 27, 2017

@IBestuzhev Do you want to submit a pull-request to update the implementation?

@IBestuzhev
Copy link
Author

No, I don't have any changes to material-ui code at the moment. I just did some checks on Code Sandbox.

@mbrookes
Copy link
Member

@IBestuzhev The question was, do you want to apply that change to Chip and submit a PR?

@IBestuzhev
Copy link
Author

IBestuzhev commented Dec 31, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: chip This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

No branches or pull requests

3 participants