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

Force wrap long text #2431

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Force wrap long text #2431

wants to merge 4 commits into from

Conversation

r100-stack
Copy link
Member

@r100-stack r100-stack commented Feb 11, 2025

Changes

Added overflow-wrap: anywhere in the iui-text mixin to force the text wrap when the word is too long. Since this mixin is used in a few other places where text is used, this change is propagated there too.

Affected components: Text, NonIdealState title and description, WorkflowDiagram step, Stepper step.

Even though the mixin is used in other places too, like SideNavigation and Tag, I believe there is no change there since ellipses are shown and the text doesn't extend on multiple lines.

Testing

  • CI passes
  • Test wrapping in a few menu components (sandbox)
Screenshots

Text with the text `"I'm a text. gyguftguyfgyfh…":

Before After
image image

NonIdealState title:

Before After
image image

WorkflowDiagram step:

Before After
image image

Stepper step:

Before After
image image

Docs

Added changesets

@r100-stack r100-stack self-assigned this Feb 11, 2025
@r100-stack r100-stack marked this pull request as ready for review February 11, 2025 21:40
@r100-stack r100-stack requested a review from a team as a code owner February 11, 2025 21:40
@r100-stack r100-stack requested review from mayank99 and smmr-dn and removed request for a team and smmr-dn February 11, 2025 21:40
@@ -31,4 +31,5 @@
$type: if(map.has-key($sizes, $type), $type, body);
font-size: map.get($sizes, $type);
font-weight: map.get($weights, $type);
overflow-wrap: anywhere;
Copy link
Contributor

@mayank99 mayank99 Feb 13, 2025

Choose a reason for hiding this comment

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

Does word-break: break-word + hyphens: auto work instead of overflow-wrap: anywhere? I think that would be safer / have fewer undesirable results.

Edit: Actually, word-break: break-word is just an alias for overflow-wrap: anywhere. So hyphens: auto is the only important part of my comment.

Suggested change
overflow-wrap: anywhere;
overflow-wrap: anywhere;
hyphens: auto;

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