Closed (outdated)
Project:
Basic
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2016 at 16:44 UTC
Updated:
17 Jul 2025 at 04:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bisonbleu commentedJust to be clear, if the string has white spaces or hyphens (i.e. '-') wrap works.
But a string such as the following won't wrap and breaks the viewport when the system tries to fit that string on one line while in portrait mode on a mobile.
/aaaaa/bbbbb/ccccc/ddddd/eeeee/fffff/ggggg/hhhhh/iiiii
Comment #3
bisonbleu commentedAnd here's a test done on https://simplytest.me/
Comment #4
bisonbleu commentedA partial solution: adding inline CSS, for example:
word-wrap: break-word;.But I'm wondering where the best place is to fix this?
Comment #5
joelpittet@bisonbleu Sorry I can't reproduce this with the latest dev release so I've got to assume it's been fixed already.
Comment #6
bisonbleu commentedOn my website, I am using 7.x-4.2+13-dev - which is the latest dev. I just loaded branch 7.x-4.x on simplytest.me. I believe that is the latest dev, right?
In both cases when viewing the test article on an iPhone 6 using mobile Safari, the string
/aaaaa/bbbbb/ccccc/ddddd/eeeee/fffff/ggggg/hhhhh/iiiiidoesn't wrap as shown in the capture in #3.I'm guessing the result you got was by squeezing your browser, right? I get properly wrapped string when I squeeze my browser (FF). But the browser is not telling the whole truth.
Can you please repeat your test on simplytest.me and then visit that page with your smart phone? I'm pretty sure you will see something resembling the capture in #3.
Comment #7
joelpittetI see what you are seeing with chrome.
Couple things I'd do but not sure if they are generally good.
I would remove
, maximum-scale=1.0, user-scalable=0from the viewport metaIt should probably just be:
<meta name="viewport" content="width=device-width,initial-scale=1">And I'd scroll content if it didn't wrap with something like
That way the user can pinch zoom still, the text will wrap if it can and if it can't it will allow scroll and not break the container.
Does that work?
Comment #8
bisonbleu commentedApplying both of your suggestions works: the container is no longer broken and where long unbreakable strings occur, the viewport scrolls horizontally.
I agree with you when you write not sure if they are generally good. Although this fix is much better than a broken container, I don't feel completely comfortable with this solution because it appears to be somewhat fragile?
Getting the wrap to properly work would of course be ideal and more scalable as far as future releases are concerned.
Thanks very much for your help on this!
Comment #9
joelpittetIt's not fragile at all. It's just a particular approach that I use most of the time.
Comment #10
bisonbleu commentedOk, not fragile then; that's good. I misread your not sure if they are generally good.
By fragile I was underlying the fact that the proposed solution doesn't directly fix the non-wrapping strings but it does stop them from breaking the container. So damages are 'contained', which is great.
Now does it make sense to build those 2 changes into the code of Basic ? With a bit of guidance, I'll help with the patch.
Comment #11
leahtard commentedThere is also the option to set the word wrap with CSS. There is also a Bourbon helper for this:
Cheers, Leah
Comment #12
joelpittet@bisonbleu was leaving room if someone had a better or alternative solution;)
Comment #13
joelpittet@bisonbleu the viewport change is actually not related to this patch and may not be needed for the fix I just noticed that should be changed. I'll do that in a separate issue. Just the overflow-x should be done here if that is the best solution.
Comment #14
bisonbleu commentedThanks Leah, that's a nice addition to the mix.
I've played with @include word-wrap(normal) and @include word-wrap(break-word). The former does nothing for long unbreakable strings. The latter does but the result isn't always ideal.
Do you know of a way to break on predefined characters e.g. '/' ?
p.s. Thanks for the update Joel.
Comment #15
joelpittetbreaking on characters could help eliviate the symtoms but not the problem it seems to me.
At some point you may run into:
supercalifragilisticexpialidociousComment #16
bisonbleu commentedlol, that's a nice word :-). Adding link to similar issue for Bartik in D8.
Comment #17
bisonbleu commentedIn the end, I realize that the theme, any theme, is unlikely to be able to solve this problem out-of-the-box - which is a complex one at that.
So what's the solution? I would say: adopting an appropriate strategy for dealing with the occurrence of long strings.
In my use-case, the long strings that are troublesome are usually URLs (absolute, relative or partial) or function names e.g. theme_commerce_price_formatted_components().
Here are 3 elements of a sound strategy.
​) in long function names e.g. adopting_an_appropriate_strategy_for_dealing_with_the_occurrence_of_long_strings()#content { overflow-x: auto; }as a safety net.With just these 3 elements, I'm able to solve most of my issues with one line of CSS. Not that css properties such as word-wrap or hyphens don't work - they do. But I would venture to say that that represents more work than coming up with a simple strategy. I would keep those for extreme and very bothersome cases that cannot be solved by strategy alone.
In the end, it all boils down to design, mobile-first design.
Comment #18
awasson commentedThanks for all the work on this back in the day.
I'm closing this as outdated because Drupal 7 is no more.
Cheers,
Andrew