Skip to content

fix(truncate): updated white-space#6737

Merged
mcoker merged 1 commit into
patternfly:v6from
mattnolting:fix-truncate-6260
Jun 24, 2024
Merged

fix(truncate): updated white-space#6737
mcoker merged 1 commit into
patternfly:v6from
mattnolting:fix-truncate-6260

Conversation

@mattnolting

Copy link
Copy Markdown
Collaborator

closes #6260

@patternfly-build

patternfly-build commented Jun 4, 2024

Copy link
Copy Markdown
Collaborator

@mcoker

mcoker commented Jun 5, 2024

Copy link
Copy Markdown
Contributor

If we're using the example code from #6260 then this is what their rendered code looks like

<span class="pf-v6-c-truncate"><span class="pf-v6-c-truncate__start" style="
">XXXXXXXXXX         1234 </span><span class="pf-v6-c-truncate__end">4567</span></span>

Looks like the issue is that the missing space is at the end of __start, which is getting collapsed since the parent is inline-grid.

white-space: pre; is one option, but would need to apply to __start to fix the bug above, not __end. However, this will also preserve all white-space, which I don't think should be the default for the truncate component.

Screenshot 2024-06-04 at 8 16 52 PM

I could see this as either a variation in core to preserve all white-space, or possibly a react enhancement that could convert any spaces at the end of __start and beginning of __end to &nbsp; maybe? cc @tlabaj wdyt?

@mattnolting

mattnolting commented Jun 5, 2024

Copy link
Copy Markdown
Collaborator Author

I could see this as either a variation in core to preserve all white-space, or possibly a react enhancement that could convert any spaces at the end of __start and beginning of __end to   maybe? cc @tlabaj wdyt?

@mcoker that was part of this update and was discussed as an option.

white-space: pre; is one option, but would need to apply to __start to fix the bug above, not __end. However, this will also preserve all white-space, which I don't think should be the default for the truncate component.

@mcoker __end needs it for the middle variant

truncate.mov

XXXXXXXXXX 1234 4567

This doesn't seem like a real use case. If it is, there's likely an error, which isn't part of this issue or our responsibility to govern.

@evwilkin @srambach WDYT?

@mcoker

mcoker commented Jun 17, 2024

Copy link
Copy Markdown
Contributor

~~@mattnolting were you going to update the parent components (or the children) to have white-space: pre? ~~

Oops, missed that the update is in a grouped selector

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

L🍕TM!

@mattnolting

Copy link
Copy Markdown
Collaborator Author

@mvollmer Does this solution work for you? Removing multiple whitespaces would require JS. That can be addressed in a followup if necessary.

@patternfly-build

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.0.0-alpha.169 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Truncate - when position "middle" splits at a space, that space disappears

3 participants