metacpan-web icon indicating copy to clipboard operation
metacpan-web copied to clipboard

'Contents' section missing in new layout

Open ahill-qim opened this issue 3 years ago • 7 comments

Describe the bug I just opened metacpan for several Perl modules and all of them are missing the Contents section that used to be at the top of the page. It doesn't appear to be anywhere in the updated layout; no menu icon or link/section in the sidebar, no scrollbar indicating it's off-screen. Two screenshots attached: one from a cached visit that I haven't refreshed which shows the old layout with the Contents section, and the other of the new layout with the Contents section missing.

To Reproduce Steps to reproduce the behavior:

  1. Go to a module in metacpan
  2. Don't see Contents section

Expected behavior Expected the Contents section to be somewhere in the new layout to easily navigate longer docs.

Screenshots

old_metacpan new_metacpan

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox v105.0.1, Chrome v105.0.5195.127

ahill-qim avatar Oct 03 '22 17:10 ahill-qim

This happens when the width of the page is less than 1200px. I don't think that is viable - we still want to show the contents in some way.

haarg avatar Oct 03 '22 17:10 haarg

I just thought to inspect the page and the Contents section is there, just hidden:

contents_hidden

Removing the 'display' property shows it, but it causes the contents to be extremely narrow:

contents_shown

ahill-qim avatar Oct 03 '22 17:10 ahill-qim

This happens when the width of the page is less than 1200px. I don't think that is viable - we still want to show the contents in some way.

Ah, yeah, that's it. I didn't see this before my previous comment. I have my second monitor setup with a ~40/60 vertical split - if I maximize the browser I do see the Contents pane like normal.

Maybe it be feasible to have an alternative, like placing it at the top of the page, if the width is less than 1200px.

ahill-qim avatar Oct 03 '22 17:10 ahill-qim

The sidebar could be narrower, could it not? I like the new layout, but there's a lot of empty space considering the old layout comfortably had the sidebar, content, and author/dependencies side by side.

ahill-qim avatar Oct 03 '22 17:10 ahill-qim

One of the reasons the width of the content was minimized had to do with readability. I outlined a little bit of it here https://github.com/metacpan/metacpan-web/issues/2708#issuecomment-1225856757.

I agree that we should still show the table of contents. I can put together a PR that pins the table of contents to the top of the page when the width is less than 1200px. I'm thinking we might still want to either hide it on smaller screens or at least set the default setting to "hide" because if the TOC is long, it will take a user a long time to scroll down the screen on smaller devices.

dhogan8 avatar Oct 04 '22 21:10 dhogan8

I agree with the readability concerns personally but will note there are people that don't (that's why I implemented an expand option for perldoc.perl.org). The centering rather than left aligning seems odd with the sidebar present though. Or perhaps it's more that it's limited width but with no indication of the edge of the "page" (i.e. a border, change in color) that makes it look like there is just empty space.

Grinnz avatar Oct 04 '22 22:10 Grinnz

I tend to agree with the readability concerns as well, but just like it'll be a pain to scroll past the table of contents on a small screen, it'll be a pain scrolling for the heading you're looking for without the TOC for longer docs. I think, for smaller screens at least, placing it in a less convenient location and hiding it by default would be a good compromise. Or, rather than pinning it at the top of the page, it could be placed within the sidebar in a scrollable container, closed by default, so that it wouldn't affect the readability of the page content.

ahill-qim avatar Oct 04 '22 22:10 ahill-qim