facebook / facebook/docusaurus

Navbar dropdown base items don't support ActiveBasePath and ActiveBaseRegex

オープン
#5,954 コメント 20 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
52

説明

### 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.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).

### Description

According to the Docusaurus [documentation](https://docusaurus.io/docs/api/themes/configuration#navbar-dropdown): `the dropdown base item is a clickable link as well, so this item can receive any of the props of a plain navbar link.`

However, this is not the case: `activeBaseRegex` and `activeBasePath` have no effect on a dropdown base item. I recreated this issue in the following sample project: https://stackblitz.com/edit/github-huqpv7-kzdx99?file=docusaurus.config.js

As you can see, the `ABP works` item highlights when viewing a doc in the `tutorial-basics` directory, while the `ABP doesn't work` item doesn't.

### Steps to reproduce

1. Create a navbar item with `type: dropdown`
2. Add some dropdown items to the base item
3. Give the base navbar item `to` and `activeBasePath/activeBaseRegex` values that are expected to work

### Expected behavior

The base navbar item for the dropdown should remain highlighted when accessing any links covered by the `activeBasePath/activeBaseRegex` value.

### Actual behavior

The base navbar item for the dropdown does not remain highlighteed.

### Your environment

- Public source code: https://stackblitz.com/edit/github-huqpv7-kzdx99?file=package.json
- Public site URL: https://github-huqpv7-kzdx99--3000.local.webcontainer.io
- Docusaurus version used: 2.0.0-beta8 for the above environment. I've recreated this issue on 2.0.0-beta9 as well but can't get Stackblitz to successfully upgrade to it for this report.
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Version 1.31.88 Chromium: 95.0.4638.69 (Official Build) (x86_64)
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOS 11.5.2

### Reproducible demo

https://stackblitz.com/edit/github-huqpv7-kzdx99?file=docusaurus.config.js

### Self-service

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。