From b85d402171e0fb93344e7f543f254f9c48b9f4ac Mon Sep 17 00:00:00 2001 From: b Date: Fri, 27 Nov 2026 23:11:51 +0100 Subject: [PATCH] fix(core): reset border-color on an empty value Setting borderColor to an empty string threw "Expected 1, 2, 3 or 4 parameters" since the shorthand is split on top-level separators, which leaves no part for an empty value. Treat it like unsetValue, so a binding that is still empty (a theme color not resolved yet) no longer aborts the view creation. Co-Authored-By: Claude Sonnet 5.5 --- packages/core/ui/styling/style-properties.spec.ts | 13 +++++++++++++ packages/core/ui/styling/style-properties.ts | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/packages/core/ui/styling/style-properties.spec.ts b/packages/core/ui/styling/style-properties.spec.ts index 252e25a3e9..4d0bd6e267 100644 --- a/packages/core/ui/styling/style-properties.spec.ts +++ b/packages/core/ui/styling/style-properties.spec.ts @@ -27,6 +27,19 @@ describe('border-color shorthand', () => { expect(label.style.borderLeftColor).toEqual(new Color('color-mix(in srgb, red 35%, blue)')); }); + it('resets the colors on an empty value', () => { + const label = new Label(); + label.style.borderColor = 'red' as any; + + expect(() => { + label.style.borderColor = '' as any; + }).not.toThrow(); + expect(label.style.borderTopColor).toBeUndefined(); + expect(label.style.borderRightColor).toBeUndefined(); + expect(label.style.borderBottomColor).toBeUndefined(); + expect(label.style.borderLeftColor).toBeUndefined(); + }); + it('still accepts comma-separated colors', () => { const label = new Label(); label.style.borderColor = 'red,blue' as any; diff --git a/packages/core/ui/styling/style-properties.ts b/packages/core/ui/styling/style-properties.ts index cf089b304e..8ac4bc93e5 100644 --- a/packages/core/ui/styling/style-properties.ts +++ b/packages/core/ui/styling/style-properties.ts @@ -772,6 +772,11 @@ const borderColorProperty = new ShorthandProperty({ } }, converter: function (value) { + // an empty string resets the colors, like unsetValue + if (value === '') { + value = unsetValue; + } + if (typeof value === 'string') { const colors = parseBorderColorPositioning(value);