Skip to content

Conversation

@dchyun
Copy link
Contributor

@dchyun dchyun commented Apr 21, 2025

๐Ÿ“Œ Summary

This PR fixes an issue with the Tag where when the text is at a specific character length, the overflow tooltip is infinitely added and removed.

๐Ÿ› ๏ธ Detailed description

This issue was originally observed in Atlas. Where when applying filters to the organization run page, the tooltip button that is added when a tag's text goes beyond a max width, was being infinitely added and removed causing the tag to flash back and forth.

This issue is caused by the fact that the font of the tag's text is changing from when it is not overflowing and using a span vs. when it is overflowing and using a button element from the Hds::TooltipButton.

In atlas there is a different default font used for button elements, that does not align to the HDS default font. This was causing the following cycle.

  1. The text is rendered for a span and the text is set to overflow
  2. The overflow causes the component to update to a tooltip button
  3. The tooltip button has a narrower font, which causes the overflow to be removed

Setting font: inherit; insures that all fonts are standardized when both the button element and span element is used.

Steps to reproduce in Atlas

  1. Run atlas locally, and go to the /settings/runs page.
  2. Click on "add filters"
  3. Add the filter Status -> Running -> Cost estimating
  4. Observe the tag issue

External Link


๐Ÿ‘€ Component checklist

๐Ÿ’ฌ Please consider using conventional comments when reviewing this PR.

@vercel
Copy link

vercel bot commented Apr 21, 2025

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Updated (UTC)
hds-showcase โœ… Ready (Inspect) Visit Preview Apr 24, 2025 4:44pm
hds-website โœ… Ready (Inspect) Visit Preview Apr 24, 2025 4:44pm

@github-actions
Copy link
Contributor

๐Ÿ“ฆ RC Packages Published

Latest commit: d546836

Published 1 packages

@hashicorp/[email protected]

yarn up -C @hashicorp/design-system-components@rc

@dchyun dchyun removed the release-candidate Publishes release candidates to npm label Apr 21, 2025
@dchyun dchyun marked this pull request as ready for review April 21, 2025 20:24
@dchyun dchyun requested a review from a team as a code owner April 21, 2025 20:24
@didoo
Copy link
Contributor

didoo commented Apr 22, 2025

@dchyun maybe it would be worth to add a specific test/example to the showcase, to make sure there are no regressions in the future and this use case is correctly covered? (see for example how it's done in the Tooltip or RichTooltip)

@dchyun
Copy link
Contributor Author

dchyun commented Apr 22, 2025

@dchyun maybe it would be worth to add a specific test/example to the showcase, to make sure there are no regressions in the future and this use case is correctly covered? (see for example how it's done in the Tooltip or RichTooltip)

@didoo Thanks for the suggestion. Added an inheritance section into the showcase page.

Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

Left a few comments, but I think I may have found the root problem.

@dchyun dchyun requested a review from didoo April 24, 2025 13:19
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

Left a couple of comment, everything is minor.

Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

LGTM

@dchyun dchyun changed the title Tag - Fix infinite adding and removing of overflow tooltip Tag - Prevent inheritance overrides for font styles Apr 24, 2025
@dchyun dchyun merged commit ee6e52a into main Apr 24, 2025
16 checks passed
@dchyun dchyun deleted the dchyun/tag-overflow-font-fix branch April 24, 2025 18:38
@hashibot-hds hashibot-hds mentioned this pull request Apr 24, 2025
@alex-ju alex-ju added this to the [email protected] milestone May 7, 2025
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.

4 participants