From 49477591ce85898de751ae08feb9371616926c12 Mon Sep 17 00:00:00 2001 From: kirandash Date: Wed, 2 Apr 2025 00:45:36 +0800 Subject: [PATCH 1/2] fix: handle z-index as unitless property The warning "Expected style 'zIndex: 1px' to be unitless" appears when setting z-index values. While z-index has no effect in SVG (as elements are painted in document order), the warning itself is incorrect since z-index should be handled as a unitless property. Added zIndex to handleSpecialCase to properly handle it before unit processing and provide a clear warning about SVG limitations. Fixes #660 --- src/handler/expand.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/handler/expand.ts b/src/handler/expand.ts index a1f39ba0..1b7be9ba 100644 --- a/src/handler/expand.ts +++ b/src/handler/expand.ts @@ -59,6 +59,13 @@ function handleSpecialCase( value: string | number, currentColor: string ) { + if (name === 'zIndex') { + console.warn( + 'z-index is not supported in SVG. Elements are painted in the order they appear in the document.' + ) + return { [name]: value } + } + if (name === 'lineHeight') { return { lineHeight: purify(name, value) } } From bdc3f4914e34cde617a10cc61d4fe1b120be2294 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Wed, 23 Jul 2025 11:27:36 +0200 Subject: [PATCH 2/2] Update src/handler/expand.ts --- src/handler/expand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/handler/expand.ts b/src/handler/expand.ts index 1b7be9ba..46b48aa6 100644 --- a/src/handler/expand.ts +++ b/src/handler/expand.ts @@ -61,7 +61,7 @@ function handleSpecialCase( ) { if (name === 'zIndex') { console.warn( - 'z-index is not supported in SVG. Elements are painted in the order they appear in the document.' + '`z-index` is currently not supported.' ) return { [name]: value } }