Unigram icon indicating copy to clipboard operation
Unigram copied to clipboard

Instant view (maybe Unigram, overall) should use a web view for displaying HTML content

Open cdimauro opened this issue 3 years ago • 5 comments

Instant view works decently on some HTML contents but on some others (especially content grabbed from internet forums) the rendered page looks really ugly.

This is because it looks like that HTML elements are displayed as single UI widgets which take-up the full space horizontally. So, you end-up with some text which is displayed nicely, but if there's an image which just follows then it's displayed below the text, alone; and so with the following content.

An example can be found on this HTML content: https://telegra.ph/Master-Axe-6-comments-01-22 Opening it with the instant preview, it gives this: image

However downloading the content from the above URL (https://telegra.ph/Master-Axe-6-comments-01-22) and displaying it with the browser it'll give a much better rendering: image

### Suggestion: instead of using a single UI widget for each HTML element to be displayed, it's much better to delegate the full HTML content rendering to a web view widget.

cdimauro avatar Jan 22 '23 21:01 cdimauro

From what I can see in #2949 and from https://instantview.telegram.org/ - Telegram actually doesn't send HTML data in Instant View, but instead - it send some kind of JSON list of elements that are interpreted by clients.

So I guess - this behavior is intended. And to be honest - if you follow provided link - it looks pretty much the same in Unigram, but images are a slightly bigger in Unigram.

makisukurisu avatar Jan 23 '23 13:01 makisukurisu

From what I can see in #2949 and from https://instantview.telegram.org/ - Telegram actually doesn't send HTML data in Instant View, but instead - it send some kind of JSON list of elements that are interpreted by clients.

I haven't found the proper API, but that's ok: at the very end the main problem is the rendering of the content.

So I guess - this behavior is intended. And to be honest - if you follow provided link - it looks pretty much the same in Unigram, but images are a slightly bigger in Unigram.

Not only the images haven't a proper size, but actually the biggest problem is that they completely break the data flow and are displayed alone on a centered horizontal box. So, they aren't treated as all other page elements (like text using a different style, for example), but they are handled separately. You can see on the browser's screenshot that the cat picture is immediately followed by a text (the user's name), then by another picture (the green circle), and so on. Whereas on Unigram those elements are displayed vertically and also pictures have the same size. This makes much more difficult reading the content, and requires more scrolling.

Another problem of the current approach is that scrolling the page (when there's a huge content) becomes more painful, because if you use the cursor or page up/down keys then you'll focus on the various UI elements, instead of providing a smooth and consistent experience like when you scroll a big page on a browser.

cdimauro avatar Jan 23 '23 21:01 cdimauro

Screenshot_20230123-231304.png

Screenshot_20230123-231251.png

If only you didn't disable css for the webpage...

In this specific example (with Telegraph) - all images are actually centered. And overall - thus is how Instant View works, it's completely intentional. (You may refer to official pages for Instant View, but, afaik - there's no "inline image" element, and all images should be centered by guidelines/design)

Arrow down is probably tightly related to accessibility, so, perhaps, it should stay as is. (The same behavior is applicable to messages in chat, if I'm not mistaken, but perhaps it requires Narrator to see it more prominently)

Fela's word is final of course, I'm just throwing some material into discussion 🐢

makisukurisu avatar Jan 23 '23 21:01 makisukurisu

If only you didn't disable css for the webpage... I haven't: I just grabbed the content from Telegraph's link using Python's requests library (so, taking the raw content and dumping it to a file. Then opening it with the browser). In this specific example (with Telegraph) - all images are actually centered. And overall - thus is how Instant View works, it's completely intentional. (You may refer to official pages for Instant View, but, afaik - there's no "inline image" element, and all images should be centered by guidelines/design)

OK, if this is by IV's design then my request goes against it and it might be rejected.

I still think that it's an improvement for the end users, but guidelines are there to be respected.

Arrow down is probably tightly related to accessibility, so, perhaps, it should stay as is. (The same behavior is applicable to messages in chat, if I'm not mistaken, but perhaps it requires Narrator to see it more prominently)

Yes, the same happens with messages. I think that it's how Unigram intrinsically works (it's a regular GUI desktop application, and those applications usually create UI widgets for every displayed object).

This has pros and cons. But, as a user and specifically for how Telegram works, I prefer to have a more "web-like" user experience for messages and IV contents (like Telegram's web version).

Fela's word is final of course, I'm just throwing some material into discussion 🐢

np. I'm just a user and I'm trying to give some contribute as well to have a better Telegram client, if possible. :)

cdimauro avatar Jan 23 '23 21:01 cdimauro

Closing this since a custom way of visualizing iv is not planned

MarcAnt01 avatar Feb 11 '23 14:02 MarcAnt01