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

Long stream name can overflow recipient header #282

Open
gnprice opened this issue Aug 23, 2023 · 1 comment
Open

Long stream name can overflow recipient header #282

gnprice opened this issue Aug 23, 2023 · 1 comment
Labels
a-design Visual and UX design a-msglist The message-list screen, except what's label:a-content upstream Would benefit from work in Flutter or another upstream

Comments

@gnprice
Copy link
Member

gnprice commented Aug 23, 2023

If a stream's name is too long to fit in the recipient header, it can take up the whole row and overflow. Here's what that looks like in a debug build:
image

In a release build, there isn't the loud striped warning, but it's still an overflow:
image

In particular there's no room left for the topic, or after #172 for the date.

Just how long the stream name needs to be to trigger this depends, naturally, on the size of the device's screen and on the font size. A user who has their system font size set to very large for readability may encounter this at a fairly ordinary length of stream name. It'll also become easier to trigger after #172, with the date occupying part of the width.

Even when things fall short of outright overflow, we'll currently show a long stream name in full even if that leaves very little room at all for the topic:
image

(The details of how this looks will change when we refresh the message list to the 2023 redesign, #157. But I think the basic layout challenge here will be unchanged.)

So we should adjust this behavior. I think what we ideally want is something like:

  • When both stream and topic name are long, they each get a fixed fraction of the available width — perhaps 50/50, or perhaps something like 40/60 to give somewhat more space to the topic.

    (Where "available" means what's left after the fixed widths that go to the date, or to padding, etc.)

  • When there's room to fit both in full, though, we show them both in full, even if that means one of them takes 90% of the available width.

    • Moreover the container for the stream name doesn't take up any slack — the topic always appears right after the text of the stream name.
  • In between, something reasonable happens. For example if one wants 90% of the available width and the other wants 20%, probably the latter gets all 20% that it wants and the other gets the other 80%.

In CSS I think this could be expressed with a fairly straightforward use of flexbox, and in particular the distinction between flex-grow (which would be nonzero only on the topic) and flex-shrink (which would be positive on both topic and stream name).

I'm not sure offhand how to express it in Flutter. Hopefully it can be done by using the basic Row widget, and its friends like Expanded and Flexible, in the right way. If not, it's always possible to do it with our own render object; but before reaching for that, I'd want to look around to see if someone in the community has produced a good implementation of a port of CSS flexbox, and consider using that instead.

@gnprice gnprice added a-msglist The message-list screen, except what's label:a-content a-design Visual and UX design labels Aug 23, 2023
@gnprice gnprice added this to the Launch milestone Aug 23, 2023
gnprice added a commit to gnprice/zulip-flutter that referenced this issue Aug 23, 2023
This size is in *physical* pixels, not logical -- so with the
tests' default device pixel ratio of 3, it corresponds to
200w267h in logical pixels, which is a very small screen.
(It's a bit over 2 inches (53mm) diagonal when converted at
160px/in, which is the nominal value for a logical pixel.)

Better to use the default size, which is somewhat more realistic.
In particular, we have a known issue (zulip#282) that the recipient headers
suffer overflow if a stream name is long.  This tiny screen causes
that issue to appear even when a name is not very long at all;
and when we add dates to the recipient headers (zulip#172), it would
start happening in the tests as they stand.

A handful of tests need adjustments to keep working with the new
size, mostly just to fill the message list with more messages.
gnprice added a commit that referenced this issue Aug 24, 2023
This size is in *physical* pixels, not logical -- so with the
tests' default device pixel ratio of 3, it corresponds to
200w267h in logical pixels, which is a very small screen.
(It's a bit over 2 inches (53mm) diagonal when converted at
160px/in, which is the nominal value for a logical pixel.)

Better to use the default size, which is somewhat more realistic.
In particular, we have a known issue (#282) that the recipient headers
suffer overflow if a stream name is long.  This tiny screen causes
that issue to appear even when a name is not very long at all;
and when we add dates to the recipient headers (#172), it would
start happening in the tests as they stand.

A handful of tests need adjustments to keep working with the new
size, mostly just to fill the message list with more messages.
@fizy069
Copy link

fizy069 commented Feb 27, 2024

Not an exact implementation of the behaviour you mentioned in your comment above, but I've solved the overflow issues and ensured that TextOverflow.ellipsis works. For now, I've given fixed values to the size of streamName/topic in case an overflow occurs, else it takes up the entire space.

Image

How does this look?

@gnprice gnprice modified the milestones: Launch, Post-launch Jul 31, 2024
@gnprice gnprice added the upstream Would benefit from work in Flutter or another upstream label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-design Visual and UX design a-msglist The message-list screen, except what's label:a-content upstream Would benefit from work in Flutter or another upstream
Projects
Status: No status
Development

No branches or pull requests

2 participants