-
Notifications
You must be signed in to change notification settings - Fork 680
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
Remove table layout for chat messages (and fix layout issues yet again) #523
Conversation
58c8a6a
to
c82887d
Compare
5787c5b
to
e8f42ca
Compare
I had played with removing the table layout for a bit, and after noticing so many bugs, I simply canceled. I need to test this PR thoroughly before we can merge or we'll do like we've been doing for a few weeks: one step forward, N steps backwards. |
Just wondering, what happens with very long names or notices? How do they overflow |
@xPaw: they wrap on multiple lines. Worse case they push the column for that one message, which is slighly uglier but has the advantage of not fucking up the whole table, so I think it's worth it anyway. I didn't change the wrapping code, so if there's something it probably was already there. |
Do you have any screenshot of this by any chance? |
What about using flexbox instead of floats? The textarea already does. |
Just curious, why removing the (CSS) table layout? I didn't know much about the use cases for this but it looks like it matches our goal fairly well, no? |
@astorije because it keeps exploding, especially with the unread marker? See the screenshot in the first post and try to tell me this is normal, expected layout for it. It's horrible. Good point for the flexbox, will definitely go with that option. |
e8f42ca
to
045e0cf
Compare
Updated to flexbox |
I'm going to stick this PR on my running version and see how it works over the next few days. That's how I found all of the bugs in @astorije's one. But this looks promising, that's for sure. |
🔪💔😭 ... 😄
Agreed, that's gross. |
That's how I test mines 😛 Not uncommon that I do a bunch of updates after opening the PR |
Found my first bug. Copy a line on the chat |
Is that a big bug though? |
It's big enough that I wouldn't be ok with 👍 this while it still exists.
That would be an acceptable solution, yeah. I had thought about doing this for exactly what you suggested at some point, but never did it. What I would really like to figure out is why is it putting in newlines in the first place? |
Most likely because of this switch. Again, I don't think there is anything we can do without breaking the layout again. Maybe try with
Right, but definitely for another PR. |
@maxpoulin64, given @YaManicKill's last comment and the fact that the 2.0.0 issue list is never ending (we have had 8-12 open issues/PRs there forever now...), do you think we could move that to the next release? |
045e0cf
to
9dac932
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff, @maxpoulin64!!
Only a few things I believe, some questions to be answered and one small thing I noticed (that margin: auto;
thingy) but hopefully this is going to be the end of an era of bugs!
I also think that all the word-wrap
and word-break
and overflow: hidden
we put all over the place to counter the effects of the table layout are going to be needed anymore. Wanna take a stab at looking at which ones can be removed?
padding: 10px 0; | ||
} | ||
|
||
#chat .msg { | ||
word-wrap: break-word; | ||
word-break: break-word; /* Webkit-specific */ | ||
display: flex; | ||
overflow: hidden; | ||
position: relative; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not figure out why these last 2 lines (overflow: hidden;
and position: relative;
) are necessary. It seems like disabling them doesn't do anything for me.
Do you remember, by any chance?
} | ||
|
||
#chat .time { | ||
color: #ddd; | ||
text-align: right; | ||
max-width: 46px; | ||
min-width: 46px; | ||
width: 46px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember I had to set these 2 explicitly, but I can't remember why specifically: 8118d56#diff-97db1f70168fb5f12457b238ff6052b5L771
Chances are, this was table-layout-specific anyway...
} | ||
|
||
#chat .from { | ||
border-right: 1px solid #f6f6f6; | ||
color: #b1c3ce; | ||
padding-right: 10px; | ||
text-align: right; | ||
max-width: 134px; | ||
min-width: 134px; | ||
width: 134px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, :shrug_emoji:
3cddbbc#diff-97db1f70168fb5f12457b238ff6052b5L754
I guess this is why we should really add some comments to our code...
client/css/style.css
Outdated
max-width: 134px; | ||
min-width: 134px; | ||
width: 134px; | ||
align-self: stretch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to see a change when I enable/disable this. Remember why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://css-tricks.com/snippets/css/a-guide-to-flexbox/, stretch
is the default value of align-items
, and align-self
is used to override it. Since this is not using align-items
, there is nothing to override. Removing.
client/css/style.css
Outdated
|
||
#chat .text { | ||
margin: auto; | ||
overflow: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is unnecessary as it is shadowed by L907/R907 anyway.
Actually, that whole block seems unnecessary with this flexbox layout now:
#chat .msg.motd .text,
#chat .msg.message .text,
#chat .msg.action .action-text,
#chat .msg.notice .text {
white-space: pre-wrap;
overflow: hidden;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playing with this more, I can't trigger something that needs it (at least on Chrome). Removing both.
client/css/style.css
Outdated
} | ||
|
||
#chat .text { | ||
margin: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been trying to fix this and none of align-items: flex-start;
, align-content: flex-start;
or self-align: flex-start;
did the trick.
I guess I'll just remove margin: auto
unless someone has reasons to believe this is going to break something else.
padding: 10px 0; | ||
} | ||
|
||
#chat .msg { | ||
word-wrap: break-word; | ||
word-break: break-word; /* Webkit-specific */ | ||
display: flex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gilles123 found out that these still need prefixing for now: #624 (comment)
Mind adding them to this PR please? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with autoprefixer and #609 this could be done magically behind the scenes :)
FYI, not directly related to this PR but still relevant: with nornagon/lounge@react...nornagon:react-chat#diff-97db1f70168fb5f12457b238ff6052b5R768 if you're curious. |
@nornagon That makes selecting messages weird. And copying the messages makes them backwards. |
@xPaw oh huh, i missed that! weird, that seems like a bug :/ |
To change how nicks overflow (instead of jumping to new line, extend it to right, this CSS needs to be added:
|
@maxpoulin64, I know you're locally running an older version of that PR, before you moved to flexbox. Do you mind updating your instance to run the latest version, so it lives in prod somewhere before merging? I'd love to ship this, but we need to make sure the issues highlighted above are fixed beforehand. |
@maxpoulin64, any chance you could be giving another stab at this? |
@astorije can you take this over? |
Will do. Do you have a list of requirements you think are important for this on the top of your head? |
@astorije just the stuff me and you pointed out. |
9dac932
to
13ef21e
Compare
This PR was 370 commits behind 😱 I have rebased it and I'm quickly testing it, but if someone (@thelounge/maintainers? @williamboman? @MaxLeiter?) would like to give it a try by merging it on their prod instance to have it run over multiple days, that would be very useful. In general, does it seem like a good idea to switch from a CSS table layout (this is not evil, calm down 😅) to flexbox? What do we gain and lose? |
I've run this on and off multiple times since it was opened, never ran into issues with it (other than it breaking other PRs such as #759). LGTM |
baf987e
to
fb672ab
Compare
@YaManicKill, @williamboman, I have made a couple changes and rebased with master. Do you mind testing this a bit on your instances? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on the channel with @xPaw, let's get this merged and deal with the fallout post-merge until we cut a release.
8 months to merge this, sorry @maxpoulin64 😅
Remove table layout for chat messages (and fix layout issues yet again)
Fixes this:
back into this:
EDIT: So, this still had bugs, so I removed the table layout entirely. This one seems to just play nice now.