Skip to content

HTML in children is not sanitized within collapsed componentΒ #33

@glennpow

Description

@glennpow

When ShowMoreText is collapsed, then any HTML tags that are present in the children (not as JSX, but as a raw string) are not sanitized properly. It appears that this happens in the Truncate inner component logic. This is a problem for us, since we do occasionally have HTML in our text, which we want to remain raw (not rendered).

Example

    const line = "<b>Test</b>\n";
    let content = "";
    for (var i = 0; i < 20; i++) {
      content += line;
    }

    return (
      <ShowMoreText
        expanded={false}
        keepNewLines={true}
        lines={5}
      >
        {content}
      </ShowMoreText>
    );

Collapsed

image

Expanded

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions