facebook / facebook/docusaurus

Scroll to selection on sidebar when visiting with a direct link

Đang mở
#7,980 9 bình luận 1 reaction 0 người được giao Xem trên GitHub
domain: theme feature
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [ ] I have tried the `npm run clear` or `yarn clear` command.
- [ ] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [ ] I have read the console error message carefully (if applicable).

### Description

When there is a long list of items in side bar, when you visit an item via a direct link, it should scroll the sidebar to the selected item.

Example: Visit this link
https://truecharts.org/docs/charts/stable/plex

A user won't know that there are 2 sub items there, until scrolls down to the said item.

It should also scroll to the selection if visit that item from a search result as well

This is probably a feature request, but I cannot login to the Canny board.
Either by gh oath or by mail. It shows error 400 on the console

### Reproducible demo

_No response_

### Steps to reproduce

1. Visit this link https://truecharts.org/docs/charts/stable/plex
2. Sidebar should scroll to the `plex` item.
3. Sidebar stays at the top

### Expected behavior

Sidebar should scroll to the `plex` item

### Actual behavior

Sidebar stays to the top

### Your environment

- Public source code: https://github.com/truecharts/website
- Public site URL: https://truecharts.org
- Docusaurus version used: 2.0.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4): gh-pages
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): gh-pages

### Self-service

- [ ] I'd be willing to fix this bug myself.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.