-
Notifications
You must be signed in to change notification settings - Fork 164
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 font size of all caps text component #4665
Conversation
Demo starting at https://vanilla-framework-4665.demos.haus |
@lyubomir-popov could you review percy and see if that's what we want? I aligned Do we want these two to align in such exact way? Percy: https://percy.io/bb49709b/vanilla-framework/builds/25319749/changed/1411902602 Demo: https://vanilla-framework-4665.demos.haus/docs/examples/patterns/headings/muted |
@bartaz that's fine we have p-text--muted which just sets the text colour to grey where needed. Maybe mention that in the release notes for anyone surprised who wants to make a heading grey again. |
Percy looks good to me |
I gave a design +1 |
// deprecated: the use of .u-align-text--x-small-to-default on small caps text is deprecated | ||
// previously small caps was implemented as x-small text variant requiring .u-align-text--x-small-to-default compensations | ||
// but now it's implemented with default text size not requiring any compensations, | ||
// so we need to reset the padding-top to the default value | ||
&.u-align-text--x-small-to-default { | ||
padding-top: map-get($nudges, p) + map-get($browser-rounding-compensations, p); | ||
} |
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.
I'm confused here, if .u-align-text--x-small-to-default
is deprecated, why do we need styles for it?
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.
Before we changed the font small caps style used to use p-text--x-small-capitalised
class, that had x-small font size and uppercase letters to fake small caps. Because it was using x-small font size it required u-align-text--x-small-to-default
if someone wanted to align it with standard text.
Now, small caps uses real small caps font, on default font size. So this util is not needed when used with p-text--small-caps
, but people already use it in their projects. When they use it in their projects we need to "reset" it to correct value.
I see 2 ways of doing it. Either the way that is here, saying .p-text--small-caps.u-align-text--x-small-to-default
reset padding top back to default (it has a benefit that we can do it together with small caps styles, but has downside that we have to hardcode the padding value to reset it back), or when where we define u-align-text--x-small-to-default
add :not(.p-text--small-caps):not(.p-text--x-small-capitalised)
so it doesn't work on these class names, but work on anything else as it should.
Let me know if it's clearer now, we can jump on a call to discuss it as well. Because indeed it is a bit dirty and confusing.
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.
Ah ok no yeah I get it! I think it's sensible the way you did it. Do we have any strategy for handling backward compatibility like this? I mean do we drop these kinds of rules in the next major version or does it stay here "forever"?
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.
We drop them in major version, because that's when we can break things and write a proper migration guide.
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.
That's why I try to mark them with // deprecated
comment in SCSS so it is easier to find. Technically there is also a @deprecated
mixin, but TBH, I haven't seen a great value in it, and it complicates the code by nesting everything one more level.
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.
Please note the .u-align-text--x-small-to-default
utility might still be useful because we are still using the small size for table headers.
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.
Yes, I'm only deprecating it when used on p-text--x-small-capitalised
(and its new name p-text--small-caps
), it is still valid utility to use with other x-small text.
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.
Perfect 👍️
Done
p-text--x-small-capitalised
top-text--small-caps
.u-align-text--x-small-to-default
usage on new style of small capsFixes #4662 #4664
QA
Demo:
u-align-text--x-small-to-default
and make sure the style is not affectedCheck if PR is ready for release
If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:
Feature 🎁
,Breaking Change 💣
,Bug 🐛
,Documentation 📝
,Maintenance 🔨
.package.json
should be updated relative to the most recent release, following semver convention:Screenshots