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

Chapters and ToC: Internal scroll #469

Merged
merged 8 commits into from
Jan 31, 2024

Conversation

adamwoodnz
Copy link
Contributor

@adamwoodnz adamwoodnz commented Jan 12, 2024

Closes #453

Depends on WordPress/wporg-mu-plugins#554, which makes the sidebar container scroll internally once it becomes fixed.

Wraps the Chapters List in a sidebar container so that it behaves the same as the ToC, but without the 'Back to top' link.

On the Code Reference the comment form rules have been moved under the form so that they no longer clash with the ToC. It now only has to reduce in height when the footer becomes visible, see discussion.

The scrolling areas have custom scrollbars so that they appear on hover. This has been inspired by the React docs (example), and should help users discover that these are scrollable more easily. With the typical Mac OS setting of hidden scrollbars, it is not immediately obvious. Note that this does not work in Firefox.

Screenshots

Code reference

Code.ref.new.toc.mp4

Block Editor

Block.editor.new.toc.and.chapters.mp4

Testing

  1. Ensure your mu-plugins is on Make sidebar container scroll internally wporg-mu-plugins#554
  2. Test pages with short ToC and/or Chapter List
  3. Test pages with long ToC and/or Chapter List
  4. Test for regressions on small screens, there should be no change
  5. Test in different browsers (check scrollbars)

@adamwoodnz adamwoodnz added this to the Iteration 1 milestone Jan 12, 2024
@adamwoodnz adamwoodnz self-assigned this Jan 12, 2024
@adamwoodnz adamwoodnz force-pushed the enhance/453-scrolling-toc-chapters branch 3 times, most recently from c134b2c to 1fb86dd Compare January 16, 2024 03:09
@adamwoodnz adamwoodnz marked this pull request as ready for review January 16, 2024 04:24
@adamwoodnz adamwoodnz requested review from StevenDufresne, ryelle, a team and renintw January 16, 2024 04:24
@fcoveram
Copy link

It works great. Excellent improvement 👏

@ryelle
Copy link
Contributor

ryelle commented Jan 16, 2024

My Chapters sidebar looks like this, it looks like there's still a position:absolute coming from somewhere. Once scrolling, the sidebars both look correct.

In the two-column layout, the chapter sidebar doesn't scroll (screenshot just to explain what layout I mean). I would expect it to continue to scroll even though the other sidebar is collapsed.

@renintw
Copy link
Contributor

renintw commented Jan 22, 2024

In the two-column layout, the chapter sidebar doesn't scroll (screenshot just to explain what layout I mean). I would expect it to continue to scroll even though the other sidebar is collapsed.

I saw this as well.

My Chapters sidebar looks like this, it looks like there's still a position:absolute coming from somewhere. Once scrolling, the sidebars both look correct.

But I was unable to reproduce this one, though.

@@ -84,8 +85,10 @@ pre {
flex-direction: row !important;
column-gap: var(--local--column-gap);

aside {
/* Left sidebar: Chapter List */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

@adamwoodnz
Copy link
Contributor Author

My Chapters sidebar looks like this, it looks like there's still a position:absolute coming from somewhere. Once scrolling, the sidebars both look correct.

Fixed the postcss nesting issues you detailed in WordPress/wporg-mu-plugins#554 so should be fixed now if you update mu-plugins

@adamwoodnz
Copy link
Contributor Author

In the two-column layout, the chapter sidebar doesn't scroll (screenshot just to explain what layout I mean). I would expect it to continue to scroll even though the other sidebar is collapsed.

Nice catch, I'll make this behaviour independent

@adamwoodnz adamwoodnz force-pushed the enhance/453-scrolling-toc-chapters branch 2 times, most recently from c0bb55e to e56a44d Compare January 29, 2024 21:02
@adamwoodnz
Copy link
Contributor Author

adamwoodnz commented Jan 30, 2024

In the two-column layout, the chapter sidebar doesn't scroll (screenshot just to explain what layout I mean). I would expect it to continue to scroll even though the other sidebar is collapsed.

I have now fixed this in WordPress/wporg-mu-plugins#554 and you should be able to retest. More details >

ipad.scrolling.sidebars.mp4

@adamwoodnz adamwoodnz requested a review from renintw January 30, 2024 04:10
@fcoveram
Copy link

The above looks great to me ⭐

@adamwoodnz adamwoodnz force-pushed the enhance/453-scrolling-toc-chapters branch from 2773920 to c0251c4 Compare January 30, 2024 21:34
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the other PR, this is working well 👍🏻

I did notice that on pages with short-content, there's no space under the chapter list. This screenshot is from the Common APIs page. Maybe sidebar-container could get some bottom margin/padding?

Screenshot 2024-01-31 at 5 14 52 PM

@adamwoodnz
Copy link
Contributor Author

I did notice that on pages with short-content, there's no space under the chapter list. This screenshot is from the Common APIs page. Maybe sidebar-container could get some bottom margin/padding?

Another great find, fixed in 40f8977

Thanks for the solid review!

@adamwoodnz adamwoodnz merged commit f44d128 into trunk Jan 31, 2024
1 check passed
@adamwoodnz adamwoodnz deleted the enhance/453-scrolling-toc-chapters branch January 31, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToC and Chapter list iteration 1
4 participants