Repository navigation
Preformatted: Scroll long lines instead of overflowing - #83873
Open
Mayank-Tripathi32 wants to merge 3 commits into
Open
Mayank-Tripathi32 wants to merge 3 commits into
Mayank-Tripathi32 wants to merge 3 commits into
Conversation
Long unbroken strings such as URLs overflowed the content area on the front end. Add overflow-x: auto so the block scrolls horizontally, as agreed in WordPress#70371.
A front-end e2e is heavy for a one-line CSS change; before/after screenshots in the PR cover it.
|
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. |
3 of 6 tasks
This branch has not been deployed
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.
What?
Closes #70371
Long unbroken lines (URLs, hashes, paths) in the Preformatted block now scroll inside the block instead of overflowing the content area on the front end.
Why?
A long string with no spaces pushes past the content width and makes the whole page scroll horizontally. In the issue, the suggestion was to apply horizontal scrolling to the Preformatted block by default.
How?
Adds
overflow-x: autoto.wp-block-preformatted.white-space: pre-wrapis kept on purpose: switching toprewould stop normal text with spaces (poems, prose) from wrapping and change existing content. With this change only lines that can't wrap get a scrollbar. The Verse block has usedoverflow: autothe same way for a long time.One open question: the editor still wraps these lines, because of the shared
overflow-wrap: break-wordrule inblock-editor/src/components/block-list/content.scss. Should Preformatted opt out of it in the editor so it matches the front end? Happy to add that here.Related: #71585.
Testing Instructions
https://example.com/followed by ~150 characters.Testing Instructions for Keyboard
No UI changes. The scrollable block can be scrolled with the arrow keys once the text inside it is focused/selected.
Screenshots or screencast
Use of AI Tools
I used Claude for investigation & testing.