-
Notifications
You must be signed in to change notification settings - Fork 12
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
Set all type style properties explicitly #294
Conversation
🦋 Changeset detectedLatest commit: 60e5d86 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying with
|
Latest commit: |
60e5d86
|
Status: | ✅ Deploy successful! |
Preview URL: | https://031c4adf.tailwind-toucan-base.pages.dev |
Branch Preview URL: | https://jl-explicit-type-style-prope.tailwind-toucan-base.pages.dev |
04df5dc
to
e3341cf
Compare
.changeset/spicy-mice-speak.md
Outdated
"@tailwind-toucan-base": patch | ||
--- | ||
|
||
chore: set all type style properties explicitly |
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.
Asking @ynotdraw here: Should this actually be a BREAKING change (minor? major?) because while this is the "correct" thing to do, it also can cause visual breaking changes?
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.
Yeah, I think a breaking change here may be safest/most valid. Especially due to:
if a parent element sets a type style that sets a medium font weight and a child sets a style that doesn't set font weight, but is expecting normal weight, then the child will render with an unexpected medium font weight.
(Also this changeset name is hilarious - spicy-mice-speak.md
🌶️ 🐭 🗣️ 😂)
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.
changeset updated
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.
spicy-mouse-steak
🤤
let geometricPrecision = { textRendering: 'geometricPrecision' }; | ||
let underline = { textDecoration: 'underline' }; | ||
|
||
// geometricPrecision text rendering makes it appear slightly |
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 explanation! Do we want a "this is what we want for Toucan" at the end?
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 feel that's implicit since we've included it, so not sure it needs that addition.
letterSpacing: theme('letterSpacing.normal'), | ||
lineHeight: theme('lineHeight.8'), | ||
textDecoration: 'initial', | ||
textRendering: 'geometricPrecision', |
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.
Why are some of these geometricPrecision
and some are initial
?
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.
oh nevermind I see that this was there from before.
@@ -82,6 +82,7 @@ | |||
"volta": { | |||
"node": "18.16.1", | |||
"yarn": "1.22.19", | |||
"npm": "9.8.0" | |||
"npm": "9.8.0", | |||
"pnpm": "7.32.5" |
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 think we can probably have only node
and pnpm
under here, as it looks like we aren't using yarn
or npm
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.
updated
.changeset/spicy-mice-speak.md
Outdated
"@tailwind-toucan-base": patch | ||
--- | ||
|
||
chore: set all type style properties explicitly |
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.
Yeah, I think a breaking change here may be safest/most valid. Especially due to:
if a parent element sets a type style that sets a medium font weight and a child sets a style that doesn't set font weight, but is expecting normal weight, then the child will render with an unexpected medium font weight.
(Also this changeset name is hilarious - spicy-mice-speak.md
🌶️ 🐭 🗣️ 😂)
pin [email protected] in line with other CS repositories
b5d68dc
to
40cd1d4
Compare
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.
🎉
dcae615
to
f83f092
Compare
@@ -8,13 +8,11 @@ module.exports = (fontSizes) => | |||
}); | |||
|
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.
A comment explaining why certain properties are set to initial
would be helpful, I think. Readers will otherwise spend a second wondering before assuming.
Also, not a big deal, but why initial
instead of the desired value? The effect is the same. But setting, say, text-rendering
to auto
is a more explicit and saves the reader a moment's time.
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 went with initial
over auto
to convey the concept that this is not setting a value, but would have the effect of 'un-setting' any inherited value. Will add a comment to that effect, but leave it as initial
rather than auto
Because CSS properties such as font-weight are inherited, if a parent element sets a type style that sets a medium font weight and a child sets a style that doesn't set font weight, but is expecting normal weight, then the child will render with an unexpected medium font weight. The same goes for text-rendering, letter-spacing and font-family, so all properties need to be explicitly set for all type styles.
f83f092
to
60e5d86
Compare
Because CSS properties such as font-weight are inherited, if a parent element sets a type style that sets a medium font weight and a child sets a style that doesn't set font weight, but is expecting normal weight, then the child will render with an unexpected medium font weight.
The same goes for text-rendering, letter-spacing and font-family, so all properties need to be explicitly set for all type styles.