From bbf6b77dc1a675a647679a9ef7fc475457d30fc2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 16 Jul 2026 21:00:02 -0400 Subject: [PATCH] fix: More comment gutter alignment fixes (#13024) --- app/editor/components/CommentGutter.tsx | 2 +- shared/editor/components/Styles.ts | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/editor/components/CommentGutter.tsx b/app/editor/components/CommentGutter.tsx index b8e4d5f221..c405b7f8ca 100644 --- a/app/editor/components/CommentGutter.tsx +++ b/app/editor/components/CommentGutter.tsx @@ -80,7 +80,7 @@ export function CommentGutter({ const Gutter = styled.div` position: absolute; - inset-inline-start: 100%; + inset-inline-start: calc(100% + ${EditorStyleHelper.padding}px); margin-inline-start: 8px; display: flex; flex-direction: column; diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index deab68eef8..bd2178fc07 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -1239,6 +1239,7 @@ ${ .notice-block { display: flex; align-items: center; + position: relative; background: ${transparentize(0.9, props.theme.noticeInfoBackground)}; border-left: 4px solid ${props.theme.noticeInfoBackground}; color: ${props.theme.noticeInfoText}; @@ -1368,18 +1369,23 @@ p { min-height: 1.6em; } +/* Make top-level paragraphs a positioning context so the comment gutter anchors + to them (flush with the content column) */ +.ProseMirror > p { + position: relative; +} + .heading-content { position: relative; } -/* The heading is the gutter's containing block (unlike paragraphs, which - resolve against the padded .ProseMirror). Pin it vertically to the line and - add the editor's horizontal padding so it aligns with other gutter marks. */ +/* The heading is taller than the line, so pin the gutter vertically to center + its indicators against the text. Horizontal alignment is handled by the + gutter's own rule. */ .heading-content .${EditorStyleHelper.commentGutter} { top: 0; bottom: 0; justify-content: center; - inset-inline-start: calc(100% + ${EditorStyleHelper.padding}px); } .heading-content a, @@ -2640,6 +2646,9 @@ li > .${EditorStyleHelper.toggleBlock} { .${EditorStyleHelper.toggleBlock} { display: flex; + /* Establish a positioning context so comment gutters on nested content anchor + here (flush with the content column) rather than the padded .ProseMirror. */ + position: relative; &:focus-within { transition-delay: 0.1s;