facebook / facebook/docusaurus

Navbar dropdown base items don't support ActiveBasePath and ActiveBaseRegex

Abierto
#5,954 20 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
TypeScript
Estrellas
66.2k
Forks
10k
Merge medio
1 d 3 h
PR fusionados (30 d)
52

Descripción

### 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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.