[PR #413] [MERGED] fix: absolute positioned elements now position relative to parent #517

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

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/413
Author: @edlsh
Created: 12/13/2025
Status: Merged
Merged: 12/15/2025
Merged by: @kommander

Base: mainHead: fix/absolute-positioning-406


📝 Commits (3)

  • b0daf63 fix: absolute positioned elements now position relative to parent
  • 90d3a1a test(core): add absolute positioning snapshot tests
  • 18b7cee prettier

📊 Changes

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

View changed files

📝 packages/core/src/Renderable.ts (+2 -2)
packages/core/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap (+481 -0)
packages/core/src/tests/absolute-positioning.snapshot.test.ts (+638 -0)

📄 Description

Fixes #406

Yoga's getComputedLayout() returns positions relative to parent (ref), but the x/y getters only added parent offset for relative elements. Removed the position type check.

Verification: Tested nested absolute child with bottom: 0 - now renders at bottom of parent container instead of global offset.


🔄 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/413 **Author:** [@edlsh](https://github.com/edlsh) **Created:** 12/13/2025 **Status:** ✅ Merged **Merged:** 12/15/2025 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix/absolute-positioning-406` --- ### 📝 Commits (3) - [`b0daf63`](https://github.com/anomalyco/opentui/commit/b0daf63a6785a2a2dd163a0b1b5f5f8a11dbe48a) fix: absolute positioned elements now position relative to parent - [`90d3a1a`](https://github.com/anomalyco/opentui/commit/90d3a1ab407d443464d963a87d30122dbd6a0d60) test(core): add absolute positioning snapshot tests - [`18b7cee`](https://github.com/anomalyco/opentui/commit/18b7cee71eae30b47a07abbec51f0ff3fd300727) prettier ### 📊 Changes **3 files changed** (+1121 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/Renderable.ts` (+2 -2) ➕ `packages/core/src/tests/__snapshots__/absolute-positioning.snapshot.test.ts.snap` (+481 -0) ➕ `packages/core/src/tests/absolute-positioning.snapshot.test.ts` (+638 -0) </details> ### 📄 Description Fixes #406 Yoga's `getComputedLayout()` returns positions relative to parent ([ref](https://github.com/facebook/yoga/issues/787)), but the x/y getters only added parent offset for `relative` elements. Removed the position type check. **Verification:** Tested nested absolute child with `bottom: 0` - now renders at bottom of parent container instead of global offset. --- <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:52 +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#517
No description provided.