-
Notifications
You must be signed in to change notification settings - Fork 841
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 EuiBadge truncation #2190
Fix EuiBadge truncation #2190
Conversation
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.
You might want to add a doc example so people don't get surprised by this. I think that's especially true if we do a more strict max width.
- Added docs example for truncations - Duplicated the `aria-label` as the `title` on the clickable icon - Keeping the `ref` and `title` attributes to the same element as `…rest` so they can be overridden - Fix max width of badges with onClick and iconOnClick - Fix text alignment - Change cursor to default unless clickable
Ok I also added a docs section for truncation which also explains the And good thing I did because I found a few more fixes detailed in this commit message. |
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.
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.
Merge conflicts?
* Fix badge truncation when a `<button>` * Added innerText to title attribute * Fix truncation if button is the child * Max width accounts for padding, etc. * Some more fixes - Added docs example for truncations - Duplicated the `aria-label` as the `title` on the clickable icon - Keeping the `ref` and `title` attributes to the same element as `…rest` so they can be overridden - Fix max width of badges with onClick and iconOnClick - Fix text alignment - Change cursor to default unless clickable
Fixes #2189
Luckily it was mostly a matter of a missing class and missing truncation mixin. I also needed to add a
max-width: 100%
otherwise it wouldn't stop at the container's width.Before -- no max-width
It wouldn't even truncate at all
Before -- with max-width
When it did truncate, it didn't do so correctly
After
Now it truncates no matter the contents. I also added the
innerText
to thetitle
attribute of the surrounding content so that consumers don't have to worry about adding this or tooltips to show the full text.Checklist
[ ] Checked in dark mode[ ] Props have proper autodocs[ ] Added documentation examples[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes