yari icon indicating copy to clipboard operation
yari copied to clipboard

Firefox reader mode is broken for some pages

Open quentinvernot opened this issue 2 years ago • 3 comments

Task List

Issues

I found some pages where opening firefox's reader mode would display incomplete content:

Doc for the WWW-Authenticate HTTP header Screenshot 2022-03-01 at 16-07-23 WWW-Authenticate - HTTP MDN

In this case, only the browser compatibility table seems to have made it in. Other pages for http headers seem to behave the same way, although some just don't have a reader mode, possibly due to very short content.

The obvious culprit seems to be the new theme, but I can't say for sure. It worked fine 2 months ago Screenshot 2022-03-01 at 16-52-48 WWW-Authenticate - HTTP MDN

Other pages seem to handle reader-mode better than other, for example the doc for Array.find() seems to work fine, only the compatibility table seems broken (and, again, it seemed better a month ago). I've been through most of the Array pages and they all seem to behave the same way.

quentinvernot avatar Mar 01 '22 15:03 quentinvernot

I just did a quick check just now, and it looks like it's almost fixed! The compatibility table is still missing in reader mode, but the rest looks exactly like it used to!

quentinvernot avatar Apr 25 '22 16:04 quentinvernot

That is great news @quentinvernot! Thank you for verifying. I believe the problem with the compatibility table is probably related to how it is loaded. @mdn/core-dev not sure how hard this would be, and perhaps the future plans for Yari will already address this, but I thought I would at least put it on your radar.

schalkneethling avatar Apr 26 '22 10:04 schalkneethling

Firefox Reader mode seems to omit tables, because it isn't trivial how to render them in a readable way:

image image

I will discuss this with the rest of the MDN engineering team, but I don't think there is much that we can do.

caugner avatar Sep 14 '22 17:09 caugner

The Firefox team pointed me to https://github.com/mozilla/readability/blob/master/Readability.js, which is the underlying implementation that decides what elements to show.

It could be that the scroll in the table-scroll class is causing the element to be hidden:

https://github.com/mozilla/readability/blob/1d2cb030b32e753cc4b7c4ce8b64c3ce4dc1b2ff/Readability.js#L128

caugner avatar Nov 15 '22 15:11 caugner

FWIW Reverting https://github.com/mdn/yari/pull/5560 indeed makes the table re-appear in the Reader View, whereas just changing or removing the table-scroll class does not seem to do the trick. 🤔

caugner avatar Nov 15 '22 16:11 caugner

Hey! Thanks for the fix, I can confirm that tables are working now! Unfortunately, the compatibility table at the end of the page is still broken.

Looking into it, it looks like this table is generated from a request to <page url>/bcd.json, which was already the case with the old theme so that's probably not the issue. The table is wrapped in a double <div> however, to have horizontal scrolling in narrow viewports, and seeing how it affected the other tables, I'd bet this is the cause of the issue here too. The wrapping is probably here for a good reason though: it's a wide and dense table, it even has responsive styles for various viewport widths, so I'm not sure how it can be fixed, I don't know this codebase enough to know where the look.

I got screenshots though:

Before

Screenshot 2022-11-16 at 20-57-41 WWW-Authenticate - HTTP MDN

(Source)

It was even scrollable and everything!

After

Screenshot 2022-11-16 at 20-58-02 WWW-Authenticate - HTTP MDN

(Source)

Would you like me to open a separate issue for this?

quentinvernot avatar Nov 16 '22 20:11 quentinvernot

Glad to hear it's working now! 🙂

Would you like me to open a separate issue for this?

I think this should be covered by https://github.com/mdn/yari/issues/3653, i.e. resolving that issue should also resolve this. (And now this issue is referenced there.)

As long as we don't server-side render BCD tables, they won't appear in the Reader Mode. 😉

caugner avatar Nov 16 '22 20:11 caugner

Alright, I'll keep an eye on https://github.com/mdn/yari/issues/3653. If that still doesn't fix the issue, I'll re-open something then.

Thank you!

quentinvernot avatar Nov 16 '22 20:11 quentinvernot