Skip to content
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

Tag - Overflow with longer text fix #2627

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

dchyun
Copy link
Contributor

@dchyun dchyun commented Dec 26, 2024

πŸ“Œ Summary

If merged, this PR would fix an issue observed in the Tag where the dismiss button background overflows the border when the text wraps to multiple lines.

πŸ› οΈ Detailed description

It was observed in the Tag that when the text exceeds 3 lines, the background of the dismiss button obscures the border of the element.

The fix provided solves the issue by adding overflow: hidden to the tag. When the dismiss button is focused, the focus ring of the button goes outside of the Tag border, so for the :focus state, the overflow: hidden is removed.

There are design efforts underway in HDS-4317 to provide more guidance or future changes around this issue. This PR is an immediate fix for the present issue.

πŸ“Έ Screenshots

Tag - Before
Screenshot 2024-12-26 at 10 24 59β€―AM

Tag - After
Screenshot 2025-01-06 at 8 41 19β€―AM

πŸ”— External links

Jira ticket: HDS-3854


πŸ‘€ Component checklist

πŸ’¬ Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented Dec 26, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
hds-showcase βœ… Ready (Inspect) Visit Preview Jan 14, 2025 9:06pm
hds-website βœ… Ready (Inspect) Visit Preview Jan 14, 2025 9:06pm

@hashibot-hds hashibot-hds added packages/components docs-website Content updates to the documentation website labels Dec 26, 2024
@dchyun dchyun marked this pull request as ready for review January 2, 2025 15:05
@dchyun dchyun requested review from a team as code owners January 2, 2025 15:05
@KristinLBradley

This comment was marked as duplicate.

Copy link
Contributor

@KristinLBradley KristinLBradley left a comment

Choose a reason for hiding this comment

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

Commented with another possible option for fixing

@dchyun

This comment was marked as duplicate.

@KristinLBradley

This comment was marked as outdated.

KristinLBradley
KristinLBradley previously approved these changes Jan 2, 2025
jorytindall
jorytindall previously approved these changes Jan 2, 2025
Copy link
Contributor

@jorytindall jorytindall left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this @dchyun ! The solution makes sense to me, and from a design perspective things are looking solid.

@heatherlarsen
Copy link
Contributor

heatherlarsen commented Jan 2, 2025

@dchyun Thanks for catching this issue! However, to distinguish between Badge and Tag, Tag should always be fully rounded (a pill shape). The current proposed solution (rectangle with a very soft border-radius) does not fit within our visual language.

I tested the Figma component and it does what you have proposed, but I don't believe we expected there to be tags that wrapped to this many lines. I'd like design to take a look at this before moving forward to see if there's an alternative solution that lets us keep the pill shape. I've created a Jira ticket to track this work, HDS-4317.

@dchyun dchyun marked this pull request as draft January 2, 2025 23:49
@dchyun

This comment was marked as outdated.

shleewhite
shleewhite previously approved these changes Jan 6, 2025
Copy link
Contributor

@shleewhite shleewhite left a comment

Choose a reason for hiding this comment

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

Nice!

@KristinLBradley
Copy link
Contributor

@dchyun If you merge in the latest main it should take care of one of the Percy visual diffs.

The other visual diff is from the fixes you made in this PR so if those are as expected they can be approved. (Merge in main first though.)

@dchyun
Copy link
Contributor Author

dchyun commented Jan 6, 2025

@dchyun If you merge in the latest main it should take care of one of the Percy visual diffs.

The other visual diff is from the fixes you made in this PR so if those are as expected they can be approved. (Merge in main first though.)

Rebased to main and just have the one Percy change needing review from design.

@dchyun dchyun requested a review from a team January 6, 2025 22:00
@majedelass
Copy link
Contributor

I also noticed the active state looks like this:
image

Active is ignoring the overflow hidden parent rule.

@dchyun
Copy link
Contributor Author

dchyun commented Jan 14, 2025

I also noticed the active state looks like this: image

Active is ignoring the overflow hidden parent rule.

Thanks for catching this. Fixed the issue by updating the CSS selectors.

The issue was that we were relying on :focus-within to set the overflow: visible, but setting the focus ring with :focus-visible on the button. This led to situations where a click with a mouse would trigger the :focus-within selector, but not the :focus-visible selector.

Copy link
Contributor

@shleewhite shleewhite left a comment

Choose a reason for hiding this comment

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

Fix is good!

Also looks like main needs to be merged in so the multi-select super select percy test updates.

@dchyun dchyun force-pushed the dchyun/tag-overflow-fix branch from b2f8f94 to 646e063 Compare January 14, 2025 21:02
@hashibot-hds hashibot-hds removed the docs-website Content updates to the documentation website label Jan 14, 2025
@dchyun dchyun marked this pull request as draft January 14, 2025 21:02
@dchyun
Copy link
Contributor Author

dchyun commented Jan 14, 2025

Reverting back to draft until @majedelass completes their exploration of the issue from the design side in HDS-4317.

Current solution solves issues with inactive, active, and hover states, but overflow still occurs on focus.
Screenshot 2025-01-14 at 3 58 15β€―PM

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.

7 participants