Skip to content

Typography.Paragraph ellipsis with rows: 1 doesn't wrap text after expanding #32732

@vzajcic

Description

@vzajcic
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

If a paragraph with expandable ellipsis is set to trigger after 1 row of text, text doesn't overflow when expanded.

Repro steps:

  • Create a Typography.Paragraph with expandable ellipsis that is triggered after 1 row of text. Example:
<Typography.Paragraph ellipsis={{ rows: 1, expandable: true }}>Nunc condimentum suscipit gravida. Aliquam accumsan venenatis orci, viverra varius quam fermentum vitae. Duis ut consequat nunc. Morbi fermentum cursus elit ac tincidunt. Curabitur consectetur scelerisque enim, non egestas arcu pharetra ac. Maecenas dignissim imperdiet tincidunt. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin arcu libero, tempus vitae consequat sit amet, posuere vel velit. Nunc quis semper nulla, eu fermentum justo. Aliquam quis leo lacinia, tempus ipsum quis, interdum est. Pellentesque velit lectus, lacinia eu mollis in, ullamcorper in eros. Integer sit amet volutpat nisl, et suscipit ligula. Integer lacinia bibendum mi, vestibulum dictum sapien faucibus eu. Integer eget urna odio. Mauris pellentesque fermentum velit, vel rutrum libero imperdiet at.</Typography.Paragraph>
  • Expand paragraph and observe its behavior
  • To compare with expected behavior, change rows to 2 or more
  • To compare with previous versions where it worked as expected, change antd version to 4.15.6 or lower

What is expected?

After expanding, the text should wrap into multiple lines. This worked as expected until version 4.16.0.

What is actually happening?

After expanding, the text doesn't wrap and it overflows out of its parent containers. The component gets a CSS class ant-typography-single-line that sets white-space: nowrap; and causes the issue. If the row number is changed to 2 or more, the issue doesn't exist anymore. Only paragraphs with ellipsis after 1 row are affected.

Environment Info
antd 4.16.13
React 17.0.2
System Microsoft Windows 10 Pro 10.0.19043 Build 19043
Browser Google Chrome 95.0.4638.69 (Official Build) (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions