diff --git a/packages/css/src/index.ts b/packages/css/src/index.ts index 3bacc0a0f..6d2dfe5cb 100644 --- a/packages/css/src/index.ts +++ b/packages/css/src/index.ts @@ -368,7 +368,7 @@ export const css = const x = styles[key as keyof typeof styles] const val = typeof x === 'function' ? x(theme) : x - if (val && typeof val === 'object') { + if (val && typeof val === 'object' && key !== '@page') { if (hasDefault(val)) { result[key] = val[THEME_UI_DEFAULT_KEY] continue diff --git a/packages/css/test/past-bugs.ts b/packages/css/test/past-bugs.ts index dfed52e38..05b5dcd56 100644 --- a/packages/css/test/past-bugs.ts +++ b/packages/css/test/past-bugs.ts @@ -31,4 +31,15 @@ describe('theme scales, get and default object property (#1439)', () => { expect(actual).toStrictEqual({ zIndex: 1 }) }) + + // https://github.com/system-ui/theme-ui/issues/2166 + test('size property works inside at page', () => { + const actual = css({ size: '2rem', '@page': { size: 'A4' } })({}) + + expect(actual).toStrictEqual({ + width: '2rem', + height: '2rem', + '@page': { size: 'A4' }, + }) + }) })