Fix review control surfaces found on the NVCA charter - #51
Merged
Merged
Conversation
Labels and comments now target the selected text instead of the whole paragraph, and the quick-action bar shows what it will act on. Selecting text inside an already-labelled or otherwise read-only paragraph updates the target, so Label no longer applies to the previously selected block. - Exclude injected annotation labels from canvas and selection text, so annotated paragraphs stay editable and their offsets stay native. - Report selections made in read-only blocks when a canvas editor is attached. - Record pure insertions as zero-width native edits; appending after a period no longer produces a spurious tracked deletion. The borrowed neighbour write remains as a fallback for inline structures. - Honour Word's w:trackRevisions setting when opening a document. - AnnotationsPanel/CommentsPanel accept a span, preview their target, take focus requests, and comments thread replies under their parent with optional host-supplied quoted context and document order. - Workspace: always-visible tracking toggle, one reviewer identity for revisions, comments and labels, formatting toolbar on every panel, quick actions that return for each new selection, tooltip labels that no longer cover neighbouring lines, no per-fragment highlight padding, and Show comment waits for an in-flight re-pagination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GUI QA on the NVCA Model COI (50 pages) turned up several control-surface problems with tracked edits, labels and comments. The main one was the reported bug: after labelling a passage, selecting other text and clicking Label did nothing visible, or labelled the previously selected paragraph.
Root causes and fixes
Labels and selection
.annot-labelcounted as paragraph text. The canvas text no longer matched the native text, so every labelled paragraph becamecontenteditable=false. Labels are now treated as generated content, both incanvasDomand in the viewer's selection mapping.onAnchorSelect. The workspace then preferred the stale editor selection (editor.selection ?? requestedAnchor), so Label applied to the wrong block. The viewer now reports text selections in read-only blocks even when a canvas editor is attached, and the workspace uses whichever selection is newest.AnnotationsPanelandCommentsPanelnow accept aspan, preview their target ("Selected text / Selected block"), and accept afocusRequest.Tracked changes
del "."+ins ". This…". Docxodus 12.6.2 accepts zero-widthreplaceMatchspans, so insertions are now zero-width, which yields one cleanw:insthat inherits the neighbour'srPr. The borrowed write stays as a fallback if the engine refuses.w:trackRevisionsreopened with tracking off.DocxSessionController.opennow honours the setting unless the host passestrackedChangesexplicitly.revisionAuthor.Presentation
.annot-highlightpadding (1px 2pxon each run fragment) opened gaps ("General .", "“ Certificate ”"). The viewer shadow root now setspadding-inline: 0.annotationMode: 'above'labels covered the preceding line. The workspace now usestooltip.Comments
CommentsPaneltakes an optionaldescribeCommentcallback; the workspace supplies the highlighted text and page order.select()(which raised "Choose a paragraph or heading to edit").New public API
useSelectionTargethook and theSelectionTargettypespan/focusRequestprops onAnnotationsPanelandCommentsPaneldescribeCommentprop onCommentsPaneland theCommentContexttypeTest plan
npm run check(lint, 92 unit tests, build, API audit)npm run test:browser: 74 passed, 2 skipped (opt-in NVCA stress and PDF)w:trackRevisionsdetection🤖 Generated with Claude Code