# Long Words not Wrapping in User Activity Page

**URL:** https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181
**Category:** Bug
**Created:** [August 16, 2017, 8:12pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181 "2017-08-16T20:12:51Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 16, 2017, 8:12pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/1 "2017-08-16T20:12:52Z")

</div>

**Reproduction Steps:**

1. Bookmark this topic: [Allow for pre-registration of fully activated accounts via API without user interaction](https://meta.discourse.org/t/allow-for-pre-registration-of-fully-activated-accounts-via-api-without-user-interaction/60339)

2. Check your bookmarks page, and you will see something similar to: 

**Possible Root Cause**

This page is styled using a table layout. I found [this commit](https://github.com/discourse/discourse/commit/1444025e9ca7c71c26706c8c99ace94878071ca4) that removes `display: table` on the parent container but `display: table-row / table-cell` are still applied to the children. By default, The widths of the table and its cells are adjusted to fit the content, and thus the right side is wider than expected.

**Possible Solutions**

1. Revert [this commit](https://github.com/discourse/discourse/commit/1444025e9ca7c71c26706c8c99ace94878071ca4) and add `table-layout: fixed`, so that the content of the table cells will not affect the width of the table.

2. Drop the table layout completely, and restyle this page with other CSS techniques. (maybe `float`? I confess I am no expert in CSS)

I’d be happy to PR this fix once we have decided a general direction.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 17, 2017, 12:52am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/2 "2017-08-17T00:52:53Z")

</div>

I would recommend simply reverting the commit @codinghorror ?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 17, 2017, 1:17am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/3 "2017-08-17T01:17:08Z")

</div>

Why not just add `word-break: break-word;` to the CSS of the HTML element container? Much simpler.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 17, 2017, 1:28am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/4 "2017-08-17T01:28:24Z")

</div>

Also looked into that option. Although it fixes the issue, but I think that’s neither needed nor intended, from a semantic point of view.

`word-wrap: break-word` works just fine on mobile, because it’s not using the table layout:

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/e/6e3df17ea1e0a7e5c0c3d3ad42692d11d35ad8c2.png).

If we were to continue using the table layout, IMHO, `table-layout: fixed` is the right fix. But again, I’m just laying out the options here.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 17, 2017, 2:21am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/5 "2017-08-17T02:21:21Z")

</div>

Probably good to keep layout more similar to mobile so go ahead with that.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 17, 2017, 3:54am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/6 "2017-08-17T03:54:16Z")

</div>

PR’s up

> <https://github.com/discourse/discourse/pull/5056>
>
> \> DISCUSSION & SCREENSHOTS: https://meta.discourse.org/t/long-words-not-wrapping…-in-user-activity-page/68181
> 
> By default, the width of a table and its cells are adjusted to fit the content. Thus, longer words are not wrapped and lead to a wider width.

* * *

**Screenshot**

 ![wordwrapfixed](https://global.discourse-cdn.com/meta/original/3X/e/d/ed20b796d84bf7f30f0b78aadb81093b208225d9.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 18, 2017, 3:48am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/7 "2017-08-18T03:48:10Z")

</div>

Hmm this regressed on iPad, now it is exceeding the available space and making everything tiny.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 18, 2017, 3:50am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/8 "2017-08-18T03:50:21Z")

</div>

I’ll take a look right now

* * *

Found out why it’s acting up. @codinghorror best to illustrate with an example that mimics the layout of the user activity page:

 ![table-width-demo](https://global.discourse-cdn.com/meta/original/3X/7/2/72819735ee44e76129d1f1c5f0b56576f794e7e6.png)

So I am suggesting to [remove `width: 900px` on `.user-right`.](https://github.com/discourse/discourse/blob/8e8653a30085f9cd1c5047da3aca2e8c1eeb87c8/app/assets/stylesheets/desktop/user.scss#L146)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 18, 2017, 4:56am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/9 "2017-08-18T04:56:11Z")

</div>

Sure feel free to submit PR on that!

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 18, 2017, 5:20am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/10 "2017-08-18T05:20:56Z")

</div>

PR round 2:

[https://github.com/discourse/discourse/pull/5060](https://github.com/discourse/discourse/pull/5060)

Sorry about that!

###### _CSS bites…_ when I am not careful enough…

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [August 18, 2017, 2:45pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/11 "2017-08-18T14:45:11Z")

</div>

This really broke the user page, so I reverted it this morning. There was a huge amount of whitespace between everything.

Did you test this PR before making it?

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 18, 2017, 7:06pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/12 "2017-08-18T19:06:22Z")

</div>

I certainly tested it with everything I had on OSX. ~~~On which platforms and browsers were this broken?~~~

* * *

Oh it’s a different tab. 🤦‍♂️

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/7/c72d4e5c46d7431da39b9d7d3b81d41ee924b41d.png)

This is the CSS for the right column on preferences tab: it has two width properties. I dropped the `900px` and the `170px` took effect. How did this work before…

Will go through `user.scss` carefully and have a more complete PR up; will also have someone else test the view this time.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 18, 2017, 7:30pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/13 "2017-08-18T19:30:08Z")

</div>

> [@xrav3nz](#):
>
> Also looked into that option. Although it fixes the issue, but I think that’s neither needed nor intended, from a semantic point of view.

I **strongly** urge you to reconsider `word-break: break-word;` given that

- we broke ipad on this already
- we’ve broken it further with each CSS change

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [August 18, 2017, 7:34pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/14 "2017-08-18T19:34:16Z")

</div>

> [@codinghorror](#):
>
> I strongly urge you to reconsider word-break: break-word;

It’s already there:

 ![46](https://global.discourse-cdn.com/meta/original/3X/f/c/fc643bec21d8c8edf4462c1f6469c83fba34790f.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 18, 2017, 7:34pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/15 "2017-08-18T19:34:56Z")

</div>

I don’t think it’s on the correct element, because in my F12 browser testing I had to add it another place for it to work (unless it got added recently).

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 18, 2017, 7:54pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/16 "2017-08-18T19:54:42Z")

</div>

That’s the correct element; it has `word-wrap: break_word` set but not `break-word: break-word`.

`word-wrap` on its own _should_ work, but it failed to do the job because:

> This page is styled using a table layout. … By default, The widths of the table and its cells are adjusted to fit the content, and thus the right side is wider than expected.

* * *

> [@codinghorror](#):
>
> I strongly urge you to reconsider word-break: break-word

I know I am guilty of breaking it twice ☹:

- It shouldn’t need to have `word-break: break-word`.
- Some inconsistencies in the existing CSS bit us. i.e. setting two different widths for the same element at two different places. This could potentially cause more problems but “luckily” everything just works right now.
- Although going through `user.scss` may take some time and some serious testing / review, _maybe_ it will help in the long run?

But again: I agree with you, that `word-break: break-word` **can** make it work, and I agree making it work is a priority.

What do you think?

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [August 19, 2017, 1:31am UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/18 "2017-08-19T01:31:10Z")

</div>

One last attempt to fix it following the table layout rules.

[https://github.com/discourse/discourse/pull/5068](https://github.com/discourse/discourse/pull/5068)

Should this fail to work / cause any other new problems, I will revert everything and use `word-break: break-word`.

* * *

@david and I both tested the change to make sure it a) fixes the previous bugs and b) does not cause new bugs. Mad props to him. 🎉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 6, 2018, 11:27pm UTC](https://meta.discourse.org/t/long-words-not-wrapping-in-user-activity-page/68181/19 "2018-02-06T23:27:19Z")

</div>


