Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix content breaking out of main container #84

Merged
merged 3 commits into from
Apr 14, 2023
Merged

Fix content breaking out of main container #84

merged 3 commits into from
Apr 14, 2023

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Apr 11, 2023

Fixes WordPress/wporg-documentation-2022#50 — Force a word break on content so that the text wraps rather than breaking out of the container.

This also removes the wrap from pre blocks, since they're usually code and the wrap distorts the indentation.

Screenshots

Three examples from Docs, and one from About, to show this works across the child themes.

Before After
1. Preformatted
Docs
t-preformatted b-preformatted
2. Code
Docs
t-list-code b-list-code
3. Link
About
t-list-link b-list-link
4. Tables
No difference, already works
t-table b-table

https://wordpress.org/documentation/article/twenty-twenty-changelog/ — For this one I edited the article itself to remove the  s between the words, which along with the break-word rule correctly wraps on small screens.

https://wordpress.org/documentation/article/what-are-smilies/ — This was another page with slightly malformed content, the table block was missing the figure wrapper. Just by updating the page I fixed the table display and now it overflows with a scroll instead of breaking the container.

How to test the changes in this Pull Request:

  1. Apply this to a sandbox
  2. View any of the linked pages on Content overflow in responsive views wporg-documentation-2022#50
  3. The page should not have a horizontal scroll
  4. Some elements on the page (preformatted blocks, tables) might have a horizontal scroll
  5. Check other pages at larger sizes too for regressions

@ryelle ryelle added the [Component] Theme Templates, patterns, CSS label Apr 11, 2023
@ryelle ryelle self-assigned this Apr 11, 2023
@@ -16,7 +16,6 @@
margin-top: var(--wp--custom--margin--baseline);

> label {
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this in the right PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this causes the content to break out of the screen when the search is in a sidebar.

@@ -0,0 +1,5 @@
.wp-block-preformatted {
white-space: pre;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is causing an issue:

Video Shortcode:

Screenshot 2023-04-13 at 1 01 19 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed the content there — looks like it was hit by this shortcode issue, it was not meant to actually embed any videos. If a video is embedded not in a pre, it should wrap the error message just fine.

@StevenDufresne
Copy link
Contributor

I'm still getting the issue I commented on on this page . Should we address this here? Its probably likely that other examples exist.

@ryelle
Copy link
Contributor Author

ryelle commented Apr 13, 2023

I'm still getting the issue I WordPress/wporg-documentation-2022#50 (comment) on this page . Should we address this here? Its probably likely that other examples exist.

I didn't fix that because that page is unpublished, no one will see it (in fact it should redirect to https://developer.wordpress.org/advanced-administration/before-install/howto-install/ now). The cause of the issue was the content itself- the image was copied over from maybe the Codex? with extra styles/classes. It's the only article I can find using thumbinner or thumbimage, so I think it's fine.

@StevenDufresne StevenDufresne self-requested a review April 13, 2023 23:23
Copy link
Contributor

@StevenDufresne StevenDufresne left a comment

Choose a reason for hiding this comment

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

From what I tested works well. 👍

We can open new tickets for more example that are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Theme Templates, patterns, CSS
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Content overflow in responsive views
2 participants