-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(16575): modify useIsTruncated hook in ListBoxMenuItem #16576
fix(16575): modify useIsTruncated hook in ListBoxMenuItem #16576
Conversation
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks for the contribution, looks good!
Awesome! Thanks for the fix! I'll keep the issue open because is was reported on the v10 branch, but I'll reference this PR if someone wants to backport the fix. |
364ffc8
Reference #16575
When the dropdown item is selected, in the control in
useIsTruncated
hook,element.lastElementChild?.lastElementChild
always be the path of the checkmark svg. OffsetWidth of this path was undefined and scrollWidth was 0. Because of thatuseIsTruncated
returns false and the tooltip was not working. I modified the inside of the hook. it always gets the offsetWidth and scrollWidth of the element so it works fine.Changelog
New
Changed
useIsTruncated
hook inListBoxMenuItem
component to always use the element's offsetWidth and scrollWidth, fixing the issue with the tooltip not displaying.Removed
useIsTruncated
hook that references the path of the checkmark svg.Testing / Reviewing
The full text of the dropdown item now appears in the tooltip on hover, whether the item is selected or not. You can see the issue before it was fixed in the issue closed by this commit.