Improve sidebar scroll behavior#1907
Conversation
|
Thanks for your PR. preview link https://web-php-pr-1907.preview.thephp.foundation/manual/en/function.strlen.php |
Exactly, it's completely intentional. The idea is to make the item visible in the side menu (automatically when the page loads). |
|
I don't think the top navigation bar should be affected. |
Oh, you mean the sidebar in the window, right? That's caused by the |
|
Done! Now the scroll doesn’t affect the window scroll or any other ancestor scroll. |
This PR fixes a bug and adds a feature to the docs sidebar.
Feature added: When you visit a page such as https://www.php.net/manual/es/function.strlen.php, the side menu scrolls all the way to the top, which is awkward from a UX perspective. What I do is detect the active element (in this example, it would be strlen), and automatically scroll to that item. If I didn’t explain that clearly, here’s a video comparison:
after.vs.before.mp4
Bug fixed: When using the J and K shortcuts to navigate through the items in the side menu, the scroll bar did not move. This PR fixes that!