-
Notifications
You must be signed in to change notification settings - Fork 370
fix(Truncate): fix text duplication in middle position #11417
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
fix(Truncate): fix text duplication in middle position #11417
Conversation
Preview: https://patternfly-react-pr-11417.surge.sh A11y report: https://patternfly-react-pr-11417-a11y.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The portion that renders the content for truncated middle may also need to be updated as well. Right now what gets rendered (using the content from the issue) is the first and second character of the content string:
Since we're just returning the str
param in the sliceContent helper instead of an array.
06a7b4c
to
b562114
Compare
after some investigation, the real issue with the original logic is that a negative value could be passed to slice, which acts as an offset to the original content string and results in a positive length that the original logic does not assume correctly. it should work now as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better 👨🏼🍳 🤌 Would be worth adding another middle truncate test when the content length is less than the trailingNumChars prop (currently we only have 2 that are both cases where content is longer than the prop value).
642ce1c
to
4ad7168
Compare
@thatblindgeye i added a bonus middle truncate test in which the length of the trailing chars exceeds the length of the original string |
What: Closes #10858
Additional issues: