Giter Club home page Giter Club logo

Comments (10)

philipwalton avatar philipwalton commented on July 21, 2024 1

@mrflix, you wrote:

But why doesn't min-width: auto incorporate word-wrap: break-word;?

Because if it did, the minimum content size would be the width of a single letter, since all words could be broken at any point. min-width: auto for text content means the width of the longest word.

@jpdevries you wrote:

I'm still confused about whether or not, according to the spec, flex items should have a calculated min-width:auto if not set.

Yes, the default is auto for flex items and 0px for block elements. It's important to keep in mind that developer tools aren't always accurate.

from flexbugs.

philipwalton avatar philipwalton commented on July 21, 2024

This isn't a bug. Firefox is correctly implementing the most recent spec updates (described in Flexbug 1). In fact, if you look at your demo in Chrome Canary, you'll see it behaves the same as Firefox.

from flexbugs.

mrflix avatar mrflix commented on July 21, 2024

I'd say it is a bug. Firefox's flex implementation can't cope with single long words.
@wilddeer thanks for the fix!

from flexbugs.

philipwalton avatar philipwalton commented on July 21, 2024

It's not a bug. Firefox is correctly implementing min-width: auto for flex items. When you change it to min-width: 0, you're just using a different value for min-width to get your example looking how you want it to look. But both values are being rendered correctly.

from flexbugs.

mrflix avatar mrflix commented on July 21, 2024

So for every flex element that could potentially contain a word longer than the element width I'd have to set the min-width to zero?
Because in a web application thats a lot of elements.

from flexbugs.

philipwalton avatar philipwalton commented on July 21, 2024

Yes, if you think this isn't ideal, you should bring it up on the www-style mailing list.

from flexbugs.

jpdevries avatar jpdevries commented on July 21, 2024

since we're talking about min-width and Firefox it might be worth noting that setting min-width OR max-width to fill-available also yields the desired result. Codepen.

.js-flex.is-fixed {
  .flex__item {
    // any of these should work
    //min-width:0;
    //min-width:fill-available;
    max-width:fill-available;
  }
}
See also

auto
The default minimum size for flex items, providing a more reasonable default than 0 for other layouts.
 — min-width MDN Docs

One thing I don't understand about min-width:auto is if it is the default minimum size for flex items then why does min-width default to 0px when not set for flex items? Shouldn't it calculate to auto? The firefox inspector says there is a calculated min-width of 0px yet if we set the min-width to 0 or 0px we get different results...


Computed min-width value of a non flex item


Computed min-width value of a flex item

from flexbugs.

mrflix avatar mrflix commented on July 21, 2024

Good point @jpdevries.

Chrome sometimes crushes flex content instead of allowing overflow: scroll. I suppose a default min-width: auto on flex elements fixes that. But why doesn't min-width: auto incorporate word-wrap: break-word;?

from flexbugs.

jpdevries avatar jpdevries commented on July 21, 2024

@mrflix I wish i could tell you. I'm still confused about whether or not, according to the spec, flex items should have a calculated min-width:auto if not set. Maybe by 'default minimum size' they mean flex-basis:auto which would make more sense.

It sounds like for your use case you'll need to specify a min-width other than auto to keep your flex item from growing infinitely.

IMO It's pretty confusing that saying "always be at least 0 in width" means "don't grow horizontally forever" which is why i think max-width:fill-available is more legible.

from flexbugs.

jpdevries avatar jpdevries commented on July 21, 2024

@philipwalton thank you for the clarification! if i get around to it, i'll work on reporting the issue with developer tools to applicable vendors

from flexbugs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.