[PR #249] [MERGED] fix(solid): init border when supporting props are present #396

Closed
opened 2026-03-02 23:46:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/249
Author: @msmps
Created: 11/1/2025
Status: Merged
Merged: 11/1/2025
Merged by: @kommander

Base: mainHead: fix/solid-border-20251101122249


📝 Commits (1)

  • 9b180cc fix(solid): init border when supporting props are present

📊 Changes

3 files changed (+108 additions, -2 deletions)

View changed files

📝 packages/core/src/renderables/Box.ts (+17 -2)
📝 packages/solid/tests/__snapshots__/layout.test.tsx.snap (+37 -0)
📝 packages/solid/tests/layout.test.tsx (+54 -0)

📄 Description

Fix: Auto-enable border when border props are set in Solid

Fixes #186

Problem

In Solid, setting borderStyle, borderColor, or focusedBorderColor on <box> elements doesn't display borders unless border is explicitly set to true. This behavior differs from React, where borders appear automatically.

// Works in React, doesn't work in Solid
<box borderStyle="single">
  <text>Content</text>
</box>

Root Cause

The Box constructor has logic to auto-enable borders when border-related props are provided. However:

  • React reconciler: Passes all props during construction
  • Solid reconciler: Only passes { id } during construction, sets props via setters afterwards
    • createElement doesn't have access to props

Solution

Extracted border initialization logic into a private initializeBorder() method and call it from the property setters for:

  • borderStyle
  • borderColor
  • focusedBorderColor

This ensures borders are auto-enabled regardless of when/how props are set.

Testing

Added test cases in packages/solid/tests/layout.test.tsx verifying borders auto-enable for all border-related props.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/249 **Author:** [@msmps](https://github.com/msmps) **Created:** 11/1/2025 **Status:** ✅ Merged **Merged:** 11/1/2025 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix/solid-border-20251101122249` --- ### 📝 Commits (1) - [`9b180cc`](https://github.com/anomalyco/opentui/commit/9b180cc55c90939d412b3149953c5c3f9afba228) fix(solid): init border when supporting props are present ### 📊 Changes **3 files changed** (+108 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderables/Box.ts` (+17 -2) 📝 `packages/solid/tests/__snapshots__/layout.test.tsx.snap` (+37 -0) 📝 `packages/solid/tests/layout.test.tsx` (+54 -0) </details> ### 📄 Description ## Fix: Auto-enable border when border props are set in Solid Fixes #186 ### Problem In Solid, setting `borderStyle`, `borderColor`, or `focusedBorderColor` on `<box>` elements doesn't display borders unless `border` is explicitly set to `true`. This behavior differs from React, where borders appear automatically. ```tsx // Works in React, doesn't work in Solid <box borderStyle="single"> <text>Content</text> </box> ``` ### Root Cause The Box constructor has logic to auto-enable borders when border-related props are provided. However: - **React reconciler**: Passes all props during construction ✅ - **Solid reconciler**: Only passes `{ id }` during construction, sets props via setters afterwards ❌ - `createElement` doesn't have access to props ### Solution Extracted border initialization logic into a private `initializeBorder()` method and call it from the property setters for: - `borderStyle` - `borderColor` - `focusedBorderColor` This ensures borders are auto-enabled regardless of when/how props are set. ### Testing Added test cases in `packages/solid/tests/layout.test.tsx` verifying borders auto-enable for all border-related props. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:46:19 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#396
No description provided.