facebook / facebook/docusaurus
Navbar dropdown base items don't support ActiveBasePath and ActiveBaseRegex
- Langage dominant
- TypeScript
- Étoiles
- 66.2k
- Forks
- 10k
- Merge moyen
- 1 j 3 h
- PR mergées (30 j)
- 52
Description
### 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.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.