-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Bad user experience with long tags #6852
Comments
Hey @briancoburn thanks for raising this issue! Could you share a use case where you do end up with really long tag names and values? I think seeing an actual use case will help us determine if this is something that is frequently happening as well as how best to handle it from a user experience perspective. |
hey @jcfilben - the image I included demonstrates the issue. The use case is that we need to support the HPE tagging standard, which says we must support 128 character names and 256 character values for the Tag. The attached image shows what that looks like should the user create Tags with really long names and/or values. We don't yet have data as to how frequently this might occur, but the issue is that we need to allow the user to enter these long names and values, and if they do, it can break the ui. If the Tag component took props which allowed the name and value to be truncated and show a tooltip, the issues shown in the attached image could be avoided. |
Is there a consensus on what specific direction this solution might take? During Office Hours just now, I volunteered my team as tribute to help address this issue. We just need to understand which approach is preferred. |
Hey @jcfilben the use case is the HPE tagging standard & back-end API support names up to 128 characters & values up to 256 characters, therefore we need to assume it will happen & design accordingly. The most common use case for us (& many other teams, I would assume) is to display I would go further than simply saying this is bad UX. It actually is possible to break the overall UI by allowing the Tags to be used as-is, because the data can & will contain strings of this length. |
Hey @samuelgoff thanks to you and your team for volunteering to help out on this issue! Currently the theme structure for the Tag component has I also think there is value in having a Hope that gives some idea of the general direction the team is envisioning. Happy to chat more on this. |
hey @jcfilben thanks for the feedback 🙏🏼 I've asked @briancoburn to look into this. Now that you've given us some more specific direction, I think this simplifies the process significantly. I'll let him direct any questions to you & team as necessary. |
I'd definitely suggest we consider a truncate prop. |
Hey @MikeKingdom I agree with you. This shouldn't require the added complexity of passing in more complex props, & I don't think it makes sense to require the granularity of control that @jcfilben is suggesting. Simply adding a truncate prop to the component makes it possible to limit the complexity of the contract while giving the component what it needs to do. If it's an all-or-nothing sort of toggle, the logical behavior is that if there is any truncation going on, then the non-truncated text -- of both name and value -- should appear inside a |
I think mirroring the API we have for Text's |
And @jcfilben beat me to it. Posting my reply as well. Hmmm... what I read was "keep the prop on Tag consistent with Text's truncate." I think there is value to keeping the API consistent for both a callers' point of view and from implementation/maintenance standpoint. As follow on, for HPE apps does it make sense to to have truncate with tip the default behavior? If so, then the theme work would also be needed. If not, the responsibility will be on the caller for each instance. |
It should be noted, however, there is an important difference between the As long the default behavior is to handle it this way, without the caller having to define this behavior, I would have no objection. |
There's risk someone may really really only want to truncate the label or value but not both, however I'm going to argue a single prop should affect both and hopefully 99% of the time only 1 of those will end up getting truncated. The typical risk of simplicity versus less typical cases... |
Agree. Let's let use cases drive the need. With proposed approach, we are not boxed in and have the ability to extend if needed in the future. |
The HPE Tag spec allows 128 characters for the Tag name and 256 characters for the Tag value. Longer Tags that approach these limits can cause ui problems and lead to a bad user experience.
Expected Behavior
Minimally, the Tag component should accept props for a character limit. If the limit is exceeded, the Tag component should truncate the characters exceeding the limit and display the entire string in a tooltip. Another approach would be to allow a user to override the internal Text elements in the Tag by passing their own custom elements as props.
Actual Behavior
See attached screenshot. For very long tag names, it might overflow the viewport and the user cannot even see the tag value. In the attached image, the Tag has white-space: no-wrap and width:fit-content styles applied. Without these, sometimes the Tag width matches that of the container rather than the content, and creates awkward line breaks that can result in a tag spanning many lines.
URL, screen shot, or Codepen exhibiting the issue
Steps to Reproduce
Create a Tag with a very long name(128 characters) and a very long value(256 characters). Put that Tag in a width-constrained container such as a cell in a Table Column. Note the Text elements in the Tag overflow the enclosing container
Your Environment
The text was updated successfully, but these errors were encountered: