Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2c1a1dc
Notes: keep the block outline, drop the spotlight dimming on note sel…
adamsilverstein Jul 20, 2026
6d65934
Notes: drop the redundant spotlight e2e assertion
adamsilverstein Jul 21, 2026
4e1ab82
Notes: highlight the whole text block for block-level notes
adamsilverstein Jul 21, 2026
5f965a5
Notes: hold the highlight tint at one low alpha in every state
adamsilverstein Jul 21, 2026
b2e691c
Notes: anchor the marker underline to currentColor at 1.5px
adamsilverstein Jul 22, 2026
222fcaf
Notes: normalize the color(srgb) form when asserting the underline color
adamsilverstein Jul 22, 2026
ef832e4
Notes: mark annotated content at rest, not only when emphasized
adamsilverstein Jul 22, 2026
a0ae378
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Jul 23, 2026
82b44bd
Notes: derive block-level highlights where they are consumed
adamsilverstein Jul 23, 2026
8db1b39
Notes: strengthen the author color in the note rules and mark non-tex…
adamsilverstein Jul 23, 2026
917b2c9
Notes: keep highlights legible under forced colors
adamsilverstein Jul 23, 2026
0241129
Notes: cover the non-text block overlay with an e2e test
adamsilverstein Jul 23, 2026
d300ad5
Collab sidebar: underline every line of block-level note text
adamsilverstein Jul 23, 2026
525a8c1
Notes: keep the marker underline steady on hover
adamsilverstein Jul 24, 2026
04ae0e9
Notes: collapse the anchoring selection once a note's marker is written
adamsilverstein Jul 24, 2026
9247c62
Notes: mark notes with an outline, not a highlight, under forced colors
adamsilverstein Jul 24, 2026
0a8e84e
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Aug 11, 2026
1771415
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Aug 23, 2026
cdea363
Merge branch 'trunk' into update/notes-highlight-combined
adamsilverstein Aug 27, 2026
9840932
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
draganescu Sep 22, 2026
2e871e7
Notes: Keep the block overlay clear of the selection outline
adamsilverstein Sep 25, 2026
5ba1fa9
Notes: Only collapse the selection if it is still on the noted text
adamsilverstein Sep 25, 2026
b78bc34
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Sep 25, 2026
2f59720
Move notes highlight changelog entries back under Unreleased
adamsilverstein Sep 25, 2026
6e0d1a2
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Oct 1, 2026
084442b
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Oct 1, 2026
eb2f16a
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Oct 5, 2026
596605b
Notes: Mark text nested in tables and use Mark/MarkText in forced colors
adamsilverstein Oct 5, 2026
cff0319
Notes: Cover block-level highlights on table cells in e2e
adamsilverstein Oct 5, 2026
244ce23
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Oct 6, 2026
04f5973
Notes: Hide the canvas highlights when notes are hidden
adamsilverstein Oct 6, 2026
bf1d021
Merge trunk into update/notes-highlight-combined
adamsilverstein Oct 8, 2026
14e61c1
Notes: Fix formatting after the trunk merge
adamsilverstein Oct 8, 2026
3f3fd01
Block Editor: Remove the unused block spotlight action and reducer
adamsilverstein Oct 8, 2026
cc46458
Notes: Mark every block-level note with one block overlay
adamsilverstein Oct 8, 2026
a0f591f
Notes: Consolidate the highlight changelog entries
adamsilverstein Oct 8, 2026
69a8975
Merge remote-tracking branch 'origin/trunk' into update/notes-highlig…
adamsilverstein Oct 9, 2026
1160164
Notes: Move the highlight changelog entry under Unreleased
adamsilverstein Oct 9, 2026
6aa7f0e
Merge trunk into update/notes-highlight-combined
adamsilverstein Oct 12, 2026
7710b42
Notes: Trim the highlight styles doc blocks to what a developer needs
adamsilverstein Oct 15, 2026
3f7cbfc
Merge branch 'trunk' into update/notes-highlight-combined
t-hamano Oct 15, 2026
db6835b
Notes: Simplify highlight styles generation
Mamaduka Oct 15, 2026
d022658
Notes: Simplify highlight e2e tests with toHaveCSS
Mamaduka Oct 15, 2026
6e60d3f
Merge branch 'trunk' into update/notes-highlight-combined
Mamaduka Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/editor/CHANGELOG.md
Comment thread
adamsilverstein marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@

### Enhancements

- Notes: Highlight the whole text block when a note is attached at the block level, in the note author's color, and replace the spotlight dimming shown while a note is selected with the block's own outline ([#72860](https://github.com/WordPress/gutenberg/issues/72860)).
- Notes: Remove "Add note" from the rich-text formatting toolbar's "More" (inline styles) dropdown. Adding a note is not an inline style, the item duplicated the block options entry, and the dropdown's chevron rendered as pressed whenever the caret sat inside a note ([#80531](https://github.com/WordPress/gutenberg/pull/80531)).

### New Features
Expand All @@ -129,6 +130,7 @@

### Bug Fixes

- Notes: Stop deepening a note's tint on hover, focus, and selection. The tint sits behind the text and is subtracted from whatever contrast the theme provides, so inline markers are emphasized with an author-tinted underline instead, and block-level notes by the block's own outline ([#80543](https://github.com/WordPress/gutenberg/issues/80543)).
- `mediaUpload`: Add an `isTransportOnly` parameter, set by the `@wordpress/upload-media` queue, which owns progress tracking and save locking for its own items and uses this function only as its server transport. Fixes the progress snackbar showing "1 of 2" for a single HEIC upload in Safari ([#80369](https://github.com/WordPress/gutenberg/issues/80369)).

### Internal
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/components/collab-sidebar/add-note.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
[]
);
const blockElement = useBlockElement( clientId );
const { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );
Comment thread
adamsilverstein marked this conversation as resolved.
Resolved
const { toggleBlockHighlight } = unlock( useDispatch( blockEditorStore ) );
const { selectNote } = unlock( useDispatch( editorStore ) );
const { getSelectedNote } = unlock( useSelect( editorStore ) );
const isSubmittingRef = useRef( false );
Expand Down Expand Up @@ -58,15 +58,15 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
* newly selected note.
*/
if ( getSelectedNote() === 'new' ) {
toggleBlockSpotlight( clientId, false );
toggleBlockHighlight( clientId, false );
selectNote( undefined );
}
} );

const unselectNote = () => {
selectNote( undefined );
blockElement?.focus();
toggleBlockSpotlight( clientId, false );
toggleBlockHighlight( clientId, false );
};

if ( selectedNote !== 'new' || ! clientId ) {
Expand Down
25 changes: 23 additions & 2 deletions packages/editor/src/components/collab-sidebar/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ export function useNoteActions() {
getSelectionStart,
getSelectionEnd,
} = useSelect( blockEditorStore );
const { updateBlockAttributes } = useDispatch( blockEditorStore );
const { selectionChange, updateBlockAttributes } =
useDispatch( blockEditorStore );

const onError = ( error ) => {
const errorMessage =
Expand Down Expand Up @@ -337,8 +338,9 @@ export function useNoteActions() {

// Inline path: also wrap the selected text with a core/note
// marker so the anchor survives later edits.
let wrapped = null;
if ( inlineSelection ) {
const wrapped = wrapInlineNote(
wrapped = wrapInlineNote(
attributes?.[ inlineSelection.attributeKey ],
savedRecord.id,
inlineSelection.start,
Expand All @@ -350,6 +352,25 @@ export function useNoteActions() {
}

updateBlockAttributes( clientId, newAttributes );

/*
* The anchoring range has done its job once the marker is
* written, but it lingers as the canvas's (inactive) native
* selection - and browsers paint text decorations inside a
* selected range with the selection's text color, so the fresh
* marker's underline would read as plain text-colored until
* the user happens to click somewhere. Collapse the selection
* to the end of the range so the marker shows its author
* color right away.
*/
if ( wrapped ) {
selectionChange(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for a reason that is not obvious from the code, and it needs a check that the user has not moved on during the save.

Why it works: the editor canvas lives in an embedded page (an iframe) inside the admin page. When you click into the sidebar, focus leaves the canvas, but the canvas's own record of which element has focus still says the paragraph. The rich-text code in packages/rich-text/src/hook/index.js only pushes a selection from state into the real page when that record points at its element, so it does push here and the collapsed selection appears. If that check is ever tightened, for example to also ask whether the iframe itself has focus, this fix silently stops working. Recording that in this comment would save the next person the investigation.

The guard: this runs unconditionally after the save request returns. If the user clicked into a different block while the request was in flight, this pulls the recorded selection back to the end of the noted text while the cursor is really somewhere else. The rich-text code will not apply it (the noted paragraph is no longer the focused element), so the editor's idea of where the cursor is and the real cursor disagree, and the toolbar and blue outline jump to the wrong block. Fix: only dispatch when getSelectionStart() still points at this clientId and inlineSelection.attributeKey.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working out why this works, that was not obvious.

Claude took this one, here is what changed:

5ba1fa9 adds the guard: the collapse only dispatches when getSelectionStart() still points at the same clientId and attributeKey. The comment now records why it reaches the canvas while focus is in the sidebar, pointing at the activeElement check in packages/rich-text/src/hook.

There is no e2e test for the in-flight case, since timing a click during the save would be flaky.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'm not sure why inline notes need this special handling in the first place.

  • Other inline formats already behave the same way. For example, a background color or an underline format is also painted with the selection colors while the text is still selected.
  • Even while the range is selected, the underline is still visible, so it's still clear that the text has an inline note.
  • This might also be an accessibility concern. selectionChange collapses the selection stored by the editor, so if a keyboard user adds an inline note and then returns to the block with Shift+Tab, the original selection is gone, and they can no longer act on the same range.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair points, especially the Shift+Tab one. Dropped it.

Claude made the change, notes below:

The post-save selection collapse is gone in bf1d021. Trunk's draft marker work (#84125) had already replaced the inlineSelection it keyed off, so it would have needed a rewrite to survive the merge anyway. The selection the note was added from is now left alone, and the e2e assertion that checked for the collapse is removed.

clientId,
inlineSelection.attributeKey,
inlineSelection.end,
inlineSelection.end
);
}
}

createNotice(
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/components/collab-sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { unlock } from '../../lock-unlock';
function NotesSidebar( { postId } ) {
const { getActiveComplementaryArea } = useSelect( interfaceStore );
const { enableComplementaryArea } = useDispatch( interfaceStore );
const { toggleBlockSpotlight, selectBlock } = unlock(
const { toggleBlockHighlight, selectBlock } = unlock(
useDispatch( blockEditorStore )
);
const { selectNote } = unlock( useDispatch( editorStore ) );
Expand Down Expand Up @@ -100,7 +100,7 @@ function NotesSidebar( { postId } ) {
// A special case for the List View, where block selection isn't required to trigger an action.
// The action won't do anything if the block is already selected.
selectBlock( targetClientId, null );
toggleBlockSpotlight( targetClientId, true );
toggleBlockHighlight( targetClientId, true );
selectNote( targetNoteId, { focus: true } );
}

Expand Down
Loading
Loading