From e7710843bea75d990c923aea02ca974a456e59f5 Mon Sep 17 00:00:00 2001 From: Luccas Correa Date: Thu, 28 May 2026 15:42:38 -0300 Subject: [PATCH 1/2] fix(layout-engine): anchor inline SDT label to start of chrome Position the inline structured-content label at the leading edge of the container instead of centering it, so it stays anchored to a consistent spot regardless of label width. --- packages/layout-engine/painters/dom/src/styles.test.ts | 4 ++++ packages/layout-engine/painters/dom/src/styles.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/layout-engine/painters/dom/src/styles.test.ts b/packages/layout-engine/painters/dom/src/styles.test.ts index a07005d614..292efb5c75 100644 --- a/packages/layout-engine/painters/dom/src/styles.test.ts +++ b/packages/layout-engine/painters/dom/src/styles.test.ts @@ -120,6 +120,10 @@ describe('ensureSdtContainerStyles', () => { expect(sharedLabelDragHandleRule).toContain('center 3px / 2px 2px no-repeat,'); expect(sharedLabelDragHandleRule).toContain('center 6px / 2px 2px no-repeat;'); expect(inlineSelectedRule).toContain('display: inline-flex;'); + expect(inlineLabelRule).toContain('left: 2px;'); + expect(inlineLabelRule).toContain('transform: none;'); + expect(inlineLabelRule).not.toContain('left: 50%;'); + expect(inlineLabelRule).not.toContain('translateX(-50%)'); expect(inlineLabelRule).toContain('border-radius: 4px 4px 0 0;'); expect(blockLabelRule).toContain('white-space: nowrap;'); expect(blockLabelRule).toContain('top: -18px;'); diff --git a/packages/layout-engine/painters/dom/src/styles.ts b/packages/layout-engine/painters/dom/src/styles.ts index 8586ef9b22..649646f4c9 100644 --- a/packages/layout-engine/painters/dom/src/styles.ts +++ b/packages/layout-engine/painters/dom/src/styles.ts @@ -740,8 +740,8 @@ const SDT_CONTAINER_STYLES = ` .superdoc-structured-content-inline__label { position: absolute; bottom: calc(100% + 1px); - left: 50%; - transform: translateX(-50%); + left: 2px; + transform: none; border-radius: 4px 4px 0 0; white-space: nowrap; z-index: 100; From c95c9d9b9411bb264e37fcb8f821c8ca3b44ac63 Mon Sep 17 00:00:00 2001 From: Luccas Correa Date: Thu, 28 May 2026 15:46:52 -0300 Subject: [PATCH 2/2] fix(layout-engine): use logical inset for inline SDT label position Replace `left: 2px` with `inset-inline-start: 2px` so the inline SDT label anchors correctly under RTL direction instead of always sticking to the physical left edge. --- packages/layout-engine/painters/dom/src/styles.test.ts | 2 +- packages/layout-engine/painters/dom/src/styles.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/layout-engine/painters/dom/src/styles.test.ts b/packages/layout-engine/painters/dom/src/styles.test.ts index 292efb5c75..cde8085734 100644 --- a/packages/layout-engine/painters/dom/src/styles.test.ts +++ b/packages/layout-engine/painters/dom/src/styles.test.ts @@ -120,7 +120,7 @@ describe('ensureSdtContainerStyles', () => { expect(sharedLabelDragHandleRule).toContain('center 3px / 2px 2px no-repeat,'); expect(sharedLabelDragHandleRule).toContain('center 6px / 2px 2px no-repeat;'); expect(inlineSelectedRule).toContain('display: inline-flex;'); - expect(inlineLabelRule).toContain('left: 2px;'); + expect(inlineLabelRule).toContain('inset-inline-start: 2px;'); expect(inlineLabelRule).toContain('transform: none;'); expect(inlineLabelRule).not.toContain('left: 50%;'); expect(inlineLabelRule).not.toContain('translateX(-50%)'); diff --git a/packages/layout-engine/painters/dom/src/styles.ts b/packages/layout-engine/painters/dom/src/styles.ts index 649646f4c9..a805e576cd 100644 --- a/packages/layout-engine/painters/dom/src/styles.ts +++ b/packages/layout-engine/painters/dom/src/styles.ts @@ -740,7 +740,7 @@ const SDT_CONTAINER_STYLES = ` .superdoc-structured-content-inline__label { position: absolute; bottom: calc(100% + 1px); - left: 2px; + inset-inline-start: 2px; transform: none; border-radius: 4px 4px 0 0; white-space: nowrap;