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

Add .break-word, improve word-break docs #880

Merged
merged 8 commits into from
Sep 5, 2019
Merged

Conversation

shawnbot
Copy link
Contributor

@shawnbot shawnbot commented Sep 4, 2019

The break-word class applies both word-break: break-word and overflow-wrap: break-word, to account for differences in the interpretation of word-break between Chrome and Firefox. See css-tricks for more info:

After describing examples of how word-break can be used in CJK content, the spec says: "To enable additional break opportunities only in the case of overflow, see overflow-wrap".

From this, we can surmise that word-break is best used with non-English content that requires specific word-breaking rules, and that might be interspersed with English content, while overflow-wrap should be used to avoid broken layouts due to long strings, regardless of the language used.

My understanding is that Chrome's interpretation is "looser", in the sense that it breaks words regardless of language; while Firefox's interpretation is more strict, essentially requiring overflow-wrap: break-word for English text.

  • Add .wb-break-word declaration
  • Add .break-word declaration
  • Add overflow-wrap: break-word !important
  • Update the docs

@shawnbot shawnbot requested a review from emilybrick September 4, 2019 22:49
@vercel
Copy link

vercel bot commented Sep 4, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://primer-css-git-wb-break-word.primer.now.sh

emilybrick
emilybrick previously approved these changes Sep 4, 2019
Copy link
Contributor

@emilybrick emilybrick left a comment

Choose a reason for hiding this comment

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

✨ 🙇‍♀

@simurai simurai mentioned this pull request Sep 5, 2019
11 tasks
@shawnbot shawnbot changed the title Add .wb-break-word Add .break-word Sep 5, 2019
@shawnbot
Copy link
Contributor Author

shawnbot commented Sep 5, 2019

FYI @emilybrick I've confirmed that the word-break: break-word and overflow-wrap: break-word combo works uniformly on (from left to right) Chrome, Safari, and Firefox using this CodePen:

image

@vercel vercel bot temporarily deployed to staging September 5, 2019 21:20 Inactive
@shawnbot shawnbot changed the title Add .break-word Add .break-word, improve word-break docs Sep 5, 2019
@shawnbot
Copy link
Contributor Author

shawnbot commented Sep 5, 2019

Okay @emilybrick, I think this is ready to review now. It's probably easiest to just look at the deployed docs and make sure that they make sense:

image

@shawnbot shawnbot requested a review from emilybrick September 5, 2019 21:41
@vercel vercel bot temporarily deployed to staging September 5, 2019 22:01 Inactive
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.

2 participants