-
Notifications
You must be signed in to change notification settings - Fork 672
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
Size shorthand is overwriting an existing CSS property #2166
Comments
Thanks for the issue @thecrowkeep! @lachlanjc do you see any solution for it other than getting rid of |
Nope, I think that's the only good way to do this |
Alternatively you could check if it's under the I'm just not sure about the complexity of implementing something like that, just wanted to throw that out there |
It makes sense. Good idea @thecrowkeep! |
Would it work to rewrite Also, relevant discussion in the CSSWG: w3c/csswg-drafts#820 |
A workaround to use until we figure out how to solve this:
Edit: Better workaround in thecrowkeep's post below ⬇ |
This is certainly helpful, though <Global
styles={() => ({ '@page': { size: '4in 6in landscape' } }) }
/> |
Oh amazing! Yeah, that’s a much more elegant solution, though let’s document it in the Global styles doc &/or with our shorthands when it’s implemented. |
Could this be related to this error I now have as of v0.14.1 around a css definitions conflict? import { Link, LinkProps } from 'theme-ui';
export const CustomLink = React.forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
return <Link ref={ref} {...props} />;
});
Or should this be a new bug? |
@herrethan That's definitely not this bug! |
@herrethan could you create an issue with some reproduction? This bug looks like something that could happen, but I can't recreate it on my side. |
@hasparus thanks, for some reason only some components now throw this error, so I'm starting to think its related to my environment. But just to add something I have noticed which sounds related: certain css properties don't play nice in sx without being explicitly cast as For example const sx = { color: 'red', display: 'block', left: 5 }
const MyButton = <Button sx={sx} /> // all good But adding const sx = { color: 'red', display: 'block', left: 5, position: 'absolute' }
const MyButton = <Button sx={sx} /> // Type 'string' is not assignable to type 'StylePropertyValue<Position | undefined>' As long as you cast your sx styles as |
I was mighty confused why my printing stylesheet wasn't working, until I finally discovered that the
size
property was being replaced withwidth
andheight
.size is a property used for defining @page size
I might recommend
wh
as a shorthand instead, as it describes the format of the string to be passed, is shorter, and is generally more descriptive thansize
. On top of not conflicting with an existing property.The text was updated successfully, but these errors were encountered: