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-anywhere utility #12128

Open
wants to merge 2 commits into
base: archive/master-2024-02-23
Choose a base branch
from

Conversation

serkodev
Copy link

@serkodev serkodev commented Oct 3, 2023

Related discussion #12127

@supports (overflow-wrap: anywhere) {
  .break-anywhere {
    overflow-wrap: anywhere;
  }
}

@supports not (overflow-wrap: anywhere) {
  .break-anywhere {
    word-break: break-word;
  }
}

@serkodev serkodev changed the title Add break-anywhere utility (#12127) Add break-anywhere utility Oct 3, 2023
@brandonmcconnell
Copy link
Contributor

@serkodev This looks great. Are there any side effects you know of for browsers that do not yet support either of these, or would this work purely, as a progressive enhancement?

@serkodev
Copy link
Author

@brandonmcconnell For browsers that do not support overflow-wrap: anywhere, it's likely that they will support the older property word-break: break-word given its longevity in the web standards.

Moreover, the @supports (not) query boasts a substantial 97.77% browser coverage. This suggests that the approach should function effectively in the vast majority of browsing environments. So it should serve as a progressive enhancement, ensuring a seamless experience for users across different browsers.

@jonathanlal
Copy link

this is much needed

@RobinMalfait RobinMalfait changed the base branch from master to archive/master-2024-02-23 March 4, 2024 21:45
@silverwind
Copy link

Imho it shouldn't use @supports for the sake of keeping it lightweight and because @supports is known to have obscure bugs. Users should be aware of the browsers they support and if the prop is not supported, I would see it as graceful degradation.

@yuheiy
Copy link
Contributor

yuheiy commented Apr 12, 2024

There are subtle differences between the behavior of word-break: break-word and overflow-wrap: anywhere, so they should not be included in the same utility class. If the users want to progressively enhance, it should be the user’s responsibility.

Tailwind states the following regarding browser support:

Tailwind CSS v3.0 is primarily designed and tested with the latest stable versions of Chrome, Firefox, Edge, and Safari, and does not support any version of Internet Explorer, including IE 11.

While the majority of Tailwind CSS features are compatible with all modern browsers, the framework also incorporates APIs for several advanced features not yet universally supported, such as the :focus-visible pseudo-class and backdrop-filter utilities.

Given that Tailwind is a foundational framework, users can easily avoid using unsupported features by simply not utilizing the corresponding utility or modifier, similar to how one would refrain from using specific CSS features in their own stylesheets.

https://tailwindcss.com/docs/browser-support

For example, the support rate for text wrap utilities is lower, but this is not a problem. Whether or not to use those properties should be left to the user’s discretion.

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.

None yet

5 participants