Notes: Fix text wrapping for long usernames in collaboration sidebar - #81406
Conversation
|
Size Change: +17 B (0%) Total Size: 7.65 MB 📦 View Changed
|
|
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>{ ' ' }
</>
), |
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
That's intentional. No autocomplete adds a space after insertion. See the original issue for discussion. |
Mamaduka
left a comment
There was a problem hiding this comment.
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.
| white-space: nowrap; | ||
| overflow-wrap: anywhere; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 does this need backporting to RC/7.1? |
|
It’s definitely a portable fix. But I’ll defer to @t-hamano regarding final call. |
…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>
|
I just cherry-picked this PR to the wp/7.1 branch to get it included in the next release: eab71bc |
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

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— droppedwhite-space: nowrapand allowed it to breakwithoverflow-wrap: anywhere, so a handle too long for the column wraps instead of overflowing..editor-collab-sidebar-panel__note-content— addedoverflow-wrap: break-word, matching what the reply field already does.Testing Instructions
userwithaloooooooonghandle.@, pick the long-handled user, then type some text after it,e.g.
hello.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
@, use the arrow keys to move through the suggestions, Enter to pick one.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.