Skip to content

Comment improvements#2438

Merged
tf merged 18 commits into
codevise:masterfrom
tf:comment-improvements
Jun 19, 2026
Merged

Comment improvements#2438
tf merged 18 commits into
codevise:masterfrom
tf:comment-improvements

Conversation

@tf

@tf tf commented Jun 19, 2026

Copy link
Copy Markdown
Member

REDMINE-21261

tf added 18 commits June 19, 2026 11:27
Selecting "new thread" from a content element's comment badge
navigated to a broken form URL because the selection carried only
an id, leaving the subject type unset. Use subject type and perma
id consistently as the new-thread selection contract across the
editor and inline editing so starting a thread works in every
case.

REDMINE-21261
Generalize the comments selection tab so it can display and start
threads for any commentable subject, not just content elements.
This unlocks section-level commenting alongside the existing
content-element comments.

REDMINE-21261
Wire the inline editing SectionDecorator to render a section comment
badge and emit sectionComments and newThread selections, so a
reviewer can open or start comment threads on a whole section just
as they can on a content element.

REDMINE-21261
List a section's comment threads under their own label-only
separator, positioned above the comment groups of the section's
content elements, so the All comments tab surfaces feedback left on
whole sections, not just on individual content elements.

REDMINE-21261
Fetch resolved threads alongside unresolved ones in EditableText so
their subject ranges keep following live edits and stay correct once a
thread is reopened. Keep resolved threads hidden from the highlight
overlay until they become the highlighted thread.

Reveal a resolved thread when it is selected from the entry comments
sidebar - for content elements and sections as well as inline text
ranges. A resolved thread has no badge of its own to react to the
SELECT_COMMENT_THREAD message, so promote it to the highlighted thread,
which reveals it, and scroll it into view. In EditableText, move the
cursor into the thread's block first so Selection's
cursorLeftHighlightedThreadBlock does not treat the pre-existing cursor
as having left the comment and re-select the content element, which
would hide the highlight again.

Extract the SELECT_COMMENT_THREAD handling into a shared
useSelectCommentThreadHandler hook used by the EditableText editor and
the content element and section decorators, instead of duplicating it
across ThreadsBadge, BadgeColumn and the editor. The hook retrieves the
subject's threads and, on a match, scrolls into view and calls the
caller-provided selectThread; an optional beforeSelect runs first.
ThreadsBadge no longer needs its confusing onSelectThread prop.
The contentElementComments and newThread editor selections were set up
with near-identical useEditorSelection calls in useCommenting,
HighlightSpan, BadgeColumn, Selection and useStartNewThread. Extract a
generic useCommentSelection hook (with a useContentElementCommentSelection
convenience wrapper) that bundles both - mutually exclusive since the
editor has one selection at a time - and exposes a normalized state
(selected, highlightedThreadId, newThreadRange) plus selectThread,
selectComments and startNewThread actions.

Route the EditableText sites and the section decorator through it,
dropping the duplicated selection setup and the literal option objects.
The handler receives selectThread directly. The content element decorator
keeps using ContentElementEditorStateProvider, which already aggregates
these selections.
Feed all tracked threads (resolved included) into the highlights that
Selection turns into commentThreadIdsAtSelection, so the selection
comments sidebar scopes to resolved threads of the cursor's block and
shows them collapsed. Keep decoration and badges on the visible subset,
so resolved threads stay hidden in the editor until highlighted.
The overlap selection (live cursor, or the highlighted thread's start
when the editor is unfocused) is identical for every badge, so compute
it once in BadgeColumn instead of searching the highlights for the
highlighted thread inside each PositionedBadge.
A resolved thread revealed from the comments sidebar shows its inline
highlight and badge only while it is the highlighted thread. Mute both
to grey, instead of the accent color, so they read as resolved -
matching how the comments sidebar de-emphasizes resolved threads.
Comment badges were portaled to the document root, so they stayed
at full size and overlaid the main storyline content once it was
scaled down for an active excursion. Render them in place instead
so they take part in that transform.

This requires the range-anchor positioning middleware to work
relative to the floating element's offsetParent rather than the
viewport, so badges no longer appear shifted or drift while the
sheet is transformed.

REDMINE-21261
Anchor comment badges in the content at fixed positions - a left
column for inline text comments, the bottom-left corner for content
elements, sticky for sections - and open the thread list below the
badge, flipping above only when it would run past the end of the
document. The list is portaled so it is not clipped by surrounding
content.

Badges now stay in place when their popover opens, fixing the
section badge that previously shifted, and corner badges on
full-width elements no longer get clipped at the viewport edge.

REDMINE-21261
Replace the textarea's autoFocus with an explicit focus({preventScroll:
true}) so focusing the field does not yank the page to the top before
the portaled popover has been positioned by floating-ui.
Let the new comment field submit on Ctrl/Cmd+Enter and show the
"Enter for new line" hint while composing, matching the reply form.
Wire the reply form's existing "Enter for new line" hint to actual
behavior by submitting on Ctrl/Cmd+Enter, reusing the shared
isSubmitShortcut helper.
The new comment form had a cancel button to collapse it back to the
thread list. Drop it entirely; users close the thread list popover to
undo expanding the form. Removes the onCancel prop from NewThreadForm
and its wiring in ThreadList, the popover and the editor new thread
view.
@tf tf added this to the v17.2 milestone Jun 19, 2026
@tf tf merged commit d4ff2a9 into codevise:master Jun 19, 2026
18 checks passed
@tf tf deleted the comment-improvements branch June 19, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant