Skip to content

fixes layout long titles + text in protostar#8312

Merged
wilsonge merged 3 commits intojoomla:stagingfrom
pe7er:protostar-title-wordwrap
May 7, 2016
Merged

fixes layout long titles + text in protostar#8312
wilsonge merged 3 commits intojoomla:stagingfrom
pe7er:protostar-title-wordwrap

Conversation

@pe7er
Copy link
Copy Markdown
Contributor

@pe7er pe7er commented Nov 7, 2015

This PR fixes the layout of long article titles & text articles in the Protostar template. If an article or text has content without spaces or a hyphen - it will continue on the same line, messing up the layout.
btw: I was not intending to use such long titles myself but I can imagine issues with words/sentences in the Thai & Welsh languages.

Testing Procedure

Before the PR

Create a new article

Content > Article > [New]
Use a very long title + article text that has no spaces or hyphens -

long_title_before1

Back-end with Isis template looks ok

In the list of Articles the Isis administrator template will nicely break the title onto multiple lines.

long_title_before2

Front-end with Protostar template looks weird

However the front-end view of the Protostar template does not break the title and text, and those both mess up the layout.

long_title_before1b

After the PR

I've added word-wrap: break-word; to h1, h2, h3, h4, h5, h6 and p so that the layout looks better. I've added it to templates/protostar/less/template.less and manually to templates/protostar/css/template.css (however it should be done with compiling instead)

long_title_after

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we habe a space between tge p and {

@pe7er
Copy link
Copy Markdown
Contributor Author

pe7er commented Nov 7, 2015

Sorry, thanks @zero-24 !

@roland-d
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on a53ea69

Tested this by creating a new article with a very long title and a very long text. Before the patch they were not wrapped and running off my screen. After applying the patch, the text and title were nicely wrapped.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8312.

@pe7er
Copy link
Copy Markdown
Contributor Author

pe7er commented Dec 12, 2015

Thanks for testing @roland-d (at Joomla Pizza Bugs & Fun, Heerenveen, Netherlands) !

@infograf768
Copy link
Copy Markdown
Member

Folks, I had done quite the same for articles display in contact
see #8612
and @Bakual told me to take it off...

Maintainers, please make up your mind...

@brianteeman
Copy link
Copy Markdown
Contributor

@infograf768 I "think" that @Bakual gave you bad advice but it was based on your incorrect code
You have

word-break: break-all;
word-wrap: break-word;

Which had the unwanted side effect that was in your PR

This PR just has

word-wrap: break-word;

But I could be talking rubbish

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Dec 12, 2015

In JMs PR it was pointed out that the title now breaks within a word when it's a title with several words. Which obviously is worse than breaking the line at spaces.
Also I questioned if there really are such ridiculous long titles in practice.
Both together and the fact that the PR dealt with two separate things I asked it to be removed.

@LourensH
Copy link
Copy Markdown

I have tested this item 🔴 unsuccessfully on a53ea69

@pe7er I made a new article and used a very long title + article text without spaces or hyphens. It was messing up the layout of the title an also the content of the article. After the PR the title was ok, but the text was not wrapped down an continued on the same line. Then i put in a "read more" , but the text after the "read more" also continued on the same line and did not fit the frame


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8312.

@infograf768
Copy link
Copy Markdown
Member

There is indeed a difference between

.break-word {
    word-break: break-all;
    word-wrap: break-word;
}

which is used in back-end.
and using only

word-wrap: break-word;

as proposed in this patch, which respects spaces AND hyphens when present.
Otherwise, the title expands on one line only.

Basically, if we have no spaces OR hyphens in the title, word-break: break-all; will force cut when reaching the width of the container.

This is a screenshot of backend without word-break: break-all; when there are spaces OR hyphens in the title (see second article from top where we only have hyphens):

screen shot 2015-12-13 at 10 08 37

and now keeping word-break: break-all;

screen shot 2015-12-13 at 10 10 31

The best solution would evidently be:

-webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  -o-hyphens: auto;
  hyphens: auto;

Alas, Chrome does not respect these...

Whatever is chosen, we should imho normalise between back-end and frontend.

@anibalsanchez
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on a53ea69

Test OK


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8312.

@brianteeman
Copy link
Copy Markdown
Contributor

Based on @Bakual comments I am setting this to Needs Review for a maintainer to make a decision


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8312.

@MDXBilal12
Copy link
Copy Markdown

I have tested this item ✅ successfully on a53ea69


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8312.

@wilsonge wilsonge merged commit f5f1160 into joomla:staging May 7, 2016
@wilsonge wilsonge added this to the Joomla 3.6.0 milestone May 7, 2016
@pe7er pe7er deleted the protostar-title-wordwrap branch September 25, 2018 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.