-
Notifications
You must be signed in to change notification settings - Fork 77
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(tab-title): tabs center when set to layout='center'
#7026
fix(tab-title): tabs center when set to layout='center'
#7026
Conversation
@@ -7,7 +7,9 @@ | |||
:host([layout="center"]) { | |||
@apply my-0 mx-5 text-center; | |||
flex-basis: theme("spacing.48"); | |||
margin: auto; | |||
.content { | |||
@apply m-auto; |
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.
given that there's no difference between margin: auto
and @apply m-auto
I'd recommend using margin: auto
it's more readable
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.
Since we're using tailwind for now, it makes sense to stick to tailwind classes if they are available, for consistency. This is what we've been doing so far. Also, overlapping uses of tailwind and regular css props might create oversight doubling use of both by accident.
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.
Agreed, lets keep tailwind for now for consistency. Hopefully we can remove tailwind in the future.
Can we add some additional screenshot tests for some more specific pre-configured cases like centered + closable, closable + bordered + centered, to hopefully catch some of these? |
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.
👍
Adding these tests revealed some mismatch with the centering with regards to Figma. There are various ways to center text/icon and the x button within a tab, as discussed with @macandcheese. We were wondering what to prioritize: matching the Figma design to make it absolutely centered (but with variable padding to offset for added close button width), or making sure the text/icon is centered between the edge of the tab and the close button. I've applied the latter for your review @SkyeSeitz @ashetland |
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.
🦭 Seal of approval! ☑️ 👍 💯 👏
@@ -7,7 +7,9 @@ | |||
:host([layout="center"]) { | |||
@apply my-0 mx-5 text-center; | |||
flex-basis: theme("spacing.48"); | |||
margin: auto; | |||
.content { | |||
@apply m-auto; |
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.
Agreed, lets keep tailwind for now for consistency. Hopefully we can remove tailwind in the future.
@@ -190,11 +192,21 @@ | |||
} | |||
} | |||
|
|||
:host([closable]) { | |||
.content { | |||
padding-inline-start: 1.5rem; |
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.
@alisonailea @Elijbet are there any tokens we can use as values for these paddings?f
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.
If this padding should be referenced from theme()
/tailwind we could do it as a followup.
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.
Let me see what design says about the centering approach in general (will determine the padding amount) and yeah that would be the next question.
…oid moving when on or off
I'll open a separate issue for the truncation, as it would need to have the tooltip applied for sighted users, just like the truncated button does. |
…ext, fix the text moving upwards in the non-bordered centered tab
:host([layout="center"][closable]) { | ||
.content { | ||
padding-inline-start: 32px; //28px button width + 0.25rem padding | ||
} |
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.
Can I get guidance on how to implement tokens here?
eg. padding-inline-start: var(--core-sizing-11);
This doesn't seem to take any effect.
Or is it something we could do as a follow-up like you said earlier @driskull?
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.
@Elijbet this is good for the release. Can you open an issue to address this by using our design tokens/tailwind for this padding? Ideally both the button width and padding should be tied to variables.
…he width of `tab-nav` (#7047) **Related Issue:** #7025 ## Summary Follow-up to fix to #7026. Centered `tabs` should spread the `tab-titles` evenly to extend across the entire width of `tab-nav`, as opposed to `inline tab-titles` that only justify against the start of `tab-nav` width. Added coverage for both `centeredTabsAreEvenlyJustifiedAcrossNavWidth` and `inlineTabsJustifyAgainstTheStartOfTheNavWidth`.
Related Issue: #7025
Summary
Enhancement to
tab-title
to make it optionallyclosable
introduced structural changes that caused a regression in the tab alignment when centered.