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

[docs] clarify that text wrapping is disabled if text-max-width is 0 #9005

Closed
wants to merge 1 commit into from

Conversation

chloekraw
Copy link
Contributor

It's a small change, but I think it's worth clarifying explicitly that setting text-max-width: 0 disables text wrapping. A customer didn't realize this was an option from our docs, and I also felt there was enough ambiguity that I tested it before suggesting it.

@ryanhamley
Copy link
Contributor

This isn't true though. If text-max-width: 0, then the text wraps on every single line break. See #8706 (comment)

@ansis
Copy link
Contributor

ansis commented Nov 21, 2019

@chloekraw I wasn't aware this had changed. It looks like using a large number for text-max-width is the right way to go.

@ansis ansis closed this Nov 21, 2019
@chloekraw
Copy link
Contributor Author

Hmm, well, we should definitely document that because that's nonintuitive 0 behavior.

I'll take another look at what I was seeing tomorrow.

@ryanhamley
Copy link
Contributor

that's nonintuitive 0 behavior.

I would argue that this behavior is exactly what you'd expect with text-max-width: 0. If the max width is 0, then you should be trying to break at every possible point because every part of the text is longer than the max width. Previously, text-max-width: 0 meant that no line breaking occurred which effectively equated 0 and Infinity which are definitely not the same things. I don't see any good reason for a max width of 0 to disable line breaking.

@chloekraw
Copy link
Contributor Author

chloekraw commented Dec 3, 2019

I would argue that this behavior is exactly what you'd expect with text-max-width: 0. ... Previously, text-max-width: 0 meant that no line breaking occurred which effectively equated 0 and Infinity which are definitely not the same things.

🤷‍♂There are enough exceptions when it comes to behavior of 0 and infinity in math and programming that I wouldn't necessarily expect anything about the behavior of text-max-width: 0 . That's why I suggested adding documentation.

My goal from the beginning has been to prevent users from having to guess or test what happens when text-max-width: 0 when they read that this input is possible in the docs. I'm not suggesting that we make 0 disable line breaking as a feature.

If the max width is 0, then you should be trying to break at every possible point because every part of the text is longer than the max width.

Sure, even if this is correct, it would be totally reasonable for people to assume that line breaking happens after every character. Most users aren't familiar with the algorithm for line breaking in the renderer and how a possible break point is defined.

I don't see any good reason for a max width of 0 to disable line breaking.

What I meant by "nonintuitive" is that line breaking at every whitespace is nonintuitive as a feature. What is the use case for this?

Even if there is a use case, text-max-width: 1 achieves this purpose in the majority of scenarios as far as I could see in Studio.

Given current constraints in the style spec, I don't think there is an obvious way to represent an option that disables line breaking without creating a new property. I think the best solution would be to create a special input for text-max-width. I thought text-max-width: 0 made sense because of what I wrote above; if we feel that the current behavior makes sense as a feature, then I would propose text-max-width: -1.

But this isn't a priority, and I'm not suggesting that the feature happens, just that we clearly document behavior of the renderer :-)

@chloekraw chloekraw deleted the docs-text-max-width-0 branch May 5, 2020 03:18
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.

3 participants