Repository navigation
Non-breaking space: Remove non-breaking spaces that would collapse when replaced - #85873
Conversation
Replacing a non-breaking space next to a regular space left two spaces, which the editor shows as a wide gap and the front end shows as one. Remove the extra spaces instead, and show the dots in the admin theme color so they don't look like an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +61 B (0%) Total Size: 8.57 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent-handling-2dd19a # Conflicts: # packages/format-library/CHANGELOG.md # packages/format-library/src/non-breaking-space/index.tsx # test/e2e/specs/editor/various/rich-text.spec.js
…ent-handling-2dd19a # Conflicts: # test/e2e/specs/editor/various/rich-text.spec.js
…ent-handling-2dd19a # Conflicts: # packages/format-library/CHANGELOG.md
|
There was a conflict while trying to cherry-pick the commit to the wp/7.2 branch. Please resolve the conflict manually and create a PR to the wp/7.2 branch. PRs to wp/7.2 are similar to PRs to trunk, but you should base your PR on the wp/7.2 branch instead of trunk. |
|
I'll handle this as part of the bulk backport. It should be faster than backporting each item individually. |
This updates the pinned commit hash of the Gutenberg repository from `cc75a79186fd23e72eb015d594e82f40c6209eb5` to `c035c1a649ef68f5c1646694cf440df1d7ae6e62` (fixes cherry-picked to the `wp/7.2` branch). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@cc75a79...c035c1a - Components: Use solid brand highlights for popup items (WordPress/gutenberg#84583) (#85848) - Fix endless sideload loop when the browser can't decode a big image (WordPress/gutenberg#83530) - Notes: Show reaction picker as a row of emoji (WordPress/gutenberg#85819) (#85892) - Notes: Add thumbs up and plus reactions (WordPress/gutenberg#85565) - Notes: Share thread focus recovery across actions (WordPress/gutenberg#85455) - Core Fields: Prevent extra space between `/` and text in slug input (WordPress/gutenberg#85935) - Notes: Add search and a status filter to the All Notes sidebar (WordPress/gutenberg#84060) - Notes: Use the note permission check when deleting a reaction (WordPress/gutenberg#85883) - [WP 7.2] Math block: Keyboard focus is trapped in the LaTeX field when the formula has an error (WordPress/gutenberg#86032) - Core fields: Keep the status icon full size when its label wraps (WordPress/gutenberg#85828) (#86050) - [WP 7.2] ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (WordPress/gutenberg#86060) - Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content (WordPress/gutenberg#84919) (#86059) - [WP 7.2] wp-build: Derive CSS module class names from each stylesheet's CSS (WordPress/gutenberg#86062) - Playlist: Allow track without an attachment ID to render on the frontend (WordPress/gutenberg#83880) (#86158) - UI: Show only the day number in Calendar day cells (WordPress/gutenberg#86010) (#86183) - Notes: Tolerate a null comment in the reaction cascade hooks (WordPress/gutenberg#85959) - Rich Text: Remove stale format boundary when field loses selection (WordPress/gutenberg#86168) - Notes: Only let a reaction's author delete it (WordPress/gutenberg#85415) - Writing flow: Fix Arrow Up and Down getting stuck at the edge of the screen (WordPress/gutenberg#85408) - Try: Run e2e tests in parallel, on one wp-env site per two cores (WordPress/gutenberg#85420) - Raw handling: Keep shortcodes in text inline (WordPress/gutenberg#85795) - Fix: Fixes non-breaking space replacement tooltip (WordPress/gutenberg#85777) - Non-breaking space: Remove non-breaking spaces that would collapse when replaced (WordPress/gutenberg#85873) Props mamaduka. See #66340. git-svn-id: https://develop.svn.wordpress.org/trunk@65225 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `cc75a79186fd23e72eb015d594e82f40c6209eb5` to `c035c1a649ef68f5c1646694cf440df1d7ae6e62` (fixes cherry-picked to the `wp/7.2` branch). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@cc75a79...c035c1a - Components: Use solid brand highlights for popup items (WordPress/gutenberg#84583) (#85848) - Fix endless sideload loop when the browser can't decode a big image (WordPress/gutenberg#83530) - Notes: Show reaction picker as a row of emoji (WordPress/gutenberg#85819) (#85892) - Notes: Add thumbs up and plus reactions (WordPress/gutenberg#85565) - Notes: Share thread focus recovery across actions (WordPress/gutenberg#85455) - Core Fields: Prevent extra space between `/` and text in slug input (WordPress/gutenberg#85935) - Notes: Add search and a status filter to the All Notes sidebar (WordPress/gutenberg#84060) - Notes: Use the note permission check when deleting a reaction (WordPress/gutenberg#85883) - [WP 7.2] Math block: Keyboard focus is trapped in the LaTeX field when the formula has an error (WordPress/gutenberg#86032) - Core fields: Keep the status icon full size when its label wraps (WordPress/gutenberg#85828) (#86050) - [WP 7.2] ToolsPanel: Keep the "Reset" label visible on the highlighted menu item (WordPress/gutenberg#86060) - Interactivity Router: Ignore router regions and attachTo targets inside data-wp-html content (WordPress/gutenberg#84919) (#86059) - [WP 7.2] wp-build: Derive CSS module class names from each stylesheet's CSS (WordPress/gutenberg#86062) - Playlist: Allow track without an attachment ID to render on the frontend (WordPress/gutenberg#83880) (#86158) - UI: Show only the day number in Calendar day cells (WordPress/gutenberg#86010) (#86183) - Notes: Tolerate a null comment in the reaction cascade hooks (WordPress/gutenberg#85959) - Rich Text: Remove stale format boundary when field loses selection (WordPress/gutenberg#86168) - Notes: Only let a reaction's author delete it (WordPress/gutenberg#85415) - Writing flow: Fix Arrow Up and Down getting stuck at the edge of the screen (WordPress/gutenberg#85408) - Try: Run e2e tests in parallel, on one wp-env site per two cores (WordPress/gutenberg#85420) - Raw handling: Keep shortcodes in text inline (WordPress/gutenberg#85795) - Fix: Fixes non-breaking space replacement tooltip (WordPress/gutenberg#85777) - Non-breaking space: Remove non-breaking spaces that would collapse when replaced (WordPress/gutenberg#85873) Props mamaduka. See #66340. Built from https://develop.svn.wordpress.org/trunk@65225 git-svn-id: http://core.svn.wordpress.org/trunk@64374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Closes #85768
When a non-breaking space sits next to a space, or at the start or end of a line, the "Replace non-breaking spaces" button removes it instead of turning it into a space. Regular spaces are never removed. The dots marking non-breaking spaces are now the admin theme color (blue by default) instead of red.
Why?
Non-breaking spaces often sit next to regular spaces, for example
word word. Replacing it gave three regular spaces in a row. HTML shows them as one, so the replaced space added nothing, and the editor (which useswhite-space: pre-wrap) showed an extra wide gap until reload.The red dot also looked like an error, while a non-breaking space is usually fine.
How?
remove()from@wordpress/rich-text, so formats stay in place.word wordbecomesword word, which HTML shows with one space.var(--wp-admin-theme-color).Which non-breaking spaces get replaced (the selection, or next to the caret) is unchanged.
Testing Instructions
Open the demo post in Playground
Testing Instructions for Keyboard
Screenshots or screencast
The new e2e test, "should remove non-breaking spaces that would collapse when replaced", fails on trunk with
one two(three spaces) instead ofone two(the two regular spaces). The test from #85777 now expectsone two, since both non-breaking spaces there sit next to each other.Use of AI Tools
Authored by Claude (Opus 5.5) in collaboration with @ellatrix.
🤖 Generated with Claude Code