Skip to content

Notes: Fix text wrapping for long usernames in collaboration sidebar - #81406

Merged
Mamaduka merged 3 commits into
trunkfrom
fix/issue-81403-notes-long-username-wrap
Aug 11, 2026
Merged

Notes: Fix text wrapping for long usernames in collaboration sidebar#81406
Mamaduka merged 3 commits into
trunkfrom
fix/issue-81403-notes-long-username-wrap

Conversation

@amitraj2203

@amitraj2203 amitraj2203 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #81403

Tagging a user with a long handle in a note no longer breaks the text layout, in the reply field or in the published comment.

Why?

The mention chip was set to never wrap (white-space: nowrap). The notes column is only ~214px wide, so a long handle makes the chip wider than the column. The note content clips its overflow, so the text isn't just squashed, it's cut off and unreadable.

How?

Two CSS changes in the collab sidebar stylesheet:

  • .wp-note-mention — dropped white-space: nowrap and allowed it to breakwith overflow-wrap: anywhere, so a handle too long for the column wraps instead of overflowing.
  • .editor-collab-sidebar-panel__note-content — added overflow-wrap: break-word, matching what the reply field already does.

Testing Instructions

  1. Create a user with a long display name, e.g. userwithaloooooooonghandle.
  2. Open a post that has a note on a block, and resolve that note.
  3. Click the resolved note and choose "Reopen & Reply".
  4. Type @, pick the long-handled user, then type some text after it,
    e.g. hello.
  5. Submit the reply.

Before: the text is cut off at the right edge, both while typing and in the posted comment.
After: it wraps and stays fully visible.

Notes that were already saved in the broken state also display correctly again, without editing them.

Testing Instructions for Keyboard

  1. Open the notes sidebar and focus the reply field.
  2. Type @, use the arrow keys to move through the suggestions, Enter to pick one.
  3. Type text, then Tab to the submit button and press Enter.
  4. Confirm the mention and the text after it wrap and stay visible.

Screenshots or screencast

Before

before.mov

After

after.mov

Use of AI Tools

Used Claude Code to help track down the cause and test the fix locally. The change is two CSS lines, reviewed and tested by me.

@amitraj2203 amitraj2203 self-assigned this Aug 11, 2026
@github-actions github-actions Bot added the [Package] Editor /packages/editor label Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Size Change: +17 B (0%)

Total Size: 7.65 MB

📦 View Changed
Filename Size Change
build/styles/editor/style-rtl.css 31.5 kB +4 B (+0.01%)
build/styles/editor/style-rtl.min.css 26.8 kB +4 B (+0.01%)
build/styles/editor/style.css 31.6 kB +4 B (+0.01%)
build/styles/editor/style.min.css 26.8 kB +5 B (+0.02%)

compressed-size-action

@amitraj2203

amitraj2203 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Currently, after adding a username mention and pressing Enter, no space is added after the mention. This causes subsequent text to be appended directly to the username unless the user manually inserts a space. Can we add logic here to automatically insert a trailing space after a mention is selected?

value: (
<span className={ `wp-note-mention user-${ user.id }` }>
{ '@' + user.name }
</span>
),

value: (
	<>
		<span className={ `wp-note-mention user-${ user.id }` }>
			{ '@' + user.name }
		</span>{ ' ' }
	</>
),

@amitraj2203
amitraj2203 marked this pull request as ready for review August 11, 2026 03:50
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: amitraj2203 <amitraj2203@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@amitraj2203 amitraj2203 added [Type] Bug An existing feature does not function as intended [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting labels Aug 11, 2026
@Mamaduka

Copy link
Copy Markdown
Member

Currently, after adding a username mention and pressing Enter, no space is added after the mention.

That's intentional. No autocomplete adds a space after insertion. See the original issue for discussion.

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @amitraj2203!

Should we also update .editor-collab-sidebar-panel__note-form [role="textbox"] to use overflow-wrap: break-word instead of legacy word-wrap: break-word?

When the description mentioned that you matched the property, it took me a moment to realize that one was using the legacy value.

Comment on lines +258 to +260
white-space: nowrap;
overflow-wrap: anywhere;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think just dropping the white-space: nowrap; will have the same effect; at least, it works in my tests.

Also, what was the reason for using anywhere instead of break-word?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review
You're right, dropping white-space: nowrap is enough, since the chip inherits overflow-wrap: break-word from .editor-collab-sidebar-panel__note-content. No real reason for anywhere over break-word they behave the same here, so I've removed it.

Also swapped the note form's legacy word-wrap for overflow-wrap so both rules match.

@Mamaduka
Mamaduka merged commit cd08bc7 into trunk Aug 11, 2026
45 checks passed
@Mamaduka
Mamaduka deleted the fix/issue-81403-notes-long-username-wrap branch August 11, 2026 11:10
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 11, 2026
@adamsilverstein

Copy link
Copy Markdown
Member

@Mamaduka does this need backporting to RC/7.1?

@Mamaduka

Copy link
Copy Markdown
Member

It’s definitely a portable fix. But I’ll defer to @t-hamano regarding final call.

@t-hamano

Copy link
Copy Markdown
Contributor

It is working well. It seems like it can be backported to 7.1.

image

@t-hamano t-hamano added the Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Aug 12, 2026
@github-actions github-actions Bot removed the Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Aug 12, 2026
gutenbergplugin pushed a commit that referenced this pull request Aug 12, 2026
…81406)

Co-authored-by: amitraj2203 <amitraj2203@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>
@github-actions github-actions Bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Aug 12, 2026
@github-actions

Copy link
Copy Markdown

I just cherry-picked this PR to the wp/7.1 branch to get it included in the next release: eab71bc

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Aug 12, 2026
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`.

A full list of changes included in this commit can be found on GitHub: 
WordPress/gutenberg@ea285b4...b9743a0

- Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277)
- Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265)
- Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291)
- Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308)
- theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253)
- theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309)
- Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311)
- Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320)
- Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374)
- Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375)
- Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385)
- fix: order site identity changes predictably (WordPress/gutenberg#81283)
- Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444)
- components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446)
- Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406)
- Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296)

Props wildworks.
See #65529.

git-svn-id: https://develop.svn.wordpress.org/branches/7.1@63209 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Notes Phase 3 of the Gutenberg roadmap around block commenting [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notes: tagging a user with a long username when un-resolving a note produces broken text wrap behavior

4 participants