question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow setting label for Versions Dropdown

See original GitHub issue

🐛 Bug Report

Prerequisites

  • 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

(A clear and concise description of what the bug is.)

Have you read the Contributing Guidelines on issues?

Yup

Steps to reproduce

Use https://new.docusaurus.io to create a CodeSandbox reproducible demo of the bug.

Versioning crashes CodeSandbox right now. Please use the example repo.

(Write your steps here:)

  1. Create a project with multi-instance docs. Each set of documentation must be versioned. Documentation is available here.
  2. Add a docsVersionDropdown navbar item for each set of docs as shown here
  3. Resize window to collapse navbar to sidebar

Expected behavior

I expected the current version label to be moved to the sidebar. (Write what you thought would happen.)

Actual behavior

The word ‘Version’ replaces the label for the current (or any) version. In projects with multiple docs this creates a really confusing user experience for anyone using the site on mobile. Screen Shot 2021-08-20 at 4 04 27 PM

It turns out this value is hard coded in the classic theme.

Screen Shot 2021-08-20 at 4 05 17 PM

It would be great if I could override that label.

Your environment

  • Public source code: N/A
  • Public site URL: N/A
  • Docusaurus version used: 2.0.0-beta 4
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Chrome Version 92.0.4515.131, Node.js v15.5.1
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOSX BigSur 11.4

Reproducible demo

https://github.com/freef/docusaurus-error-example

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
freefcommented, Aug 25, 2021

Hmmm… I think that the simplest solution would be to add a field called something like mobileLabel to the docsVersionDropdown with a default value of Version. Then change the line in the screenshot to

const dropdownLabel = mobile && items ? dropdownVersion.mobileLabel : dropdownVersion.label;
0reactions
slorbercommented, Dec 14, 2022

@andrewnicols if would help if you could share what’s the target experience you aim for instead of what’s not working at the moment. Do you know existing sites implementing exactly the UX you want?

The version dropdown shows the current version, but if you click on it (without waiting for it to open the dropdown) it takes you to the landing page for that doc

That doesn’t seem like a bad default behavior and is consistent with all the other dropdowns we have.

Having it display the current version is not always intuitive

In which case? Who reported what problem exactly?

it is not relevant for non-versioned docs.

If your docs is unversioned, why would you use this version dropdown anyway 🤷‍♂️ you shouldn’t use it.

I wonder whether the proposal that @slorber mentions to have it in the sidebar would resolve these issues and make it clearer, but I’m hesitant to swizzle this when it feels like it should be a core feature.

The core feature of Docusaurus is to be flexible and to allow you to bend it to your custom needs

If the version dropdown item doesn’t work for you, it’s possible to add your own custom navbar items: https://github.com/facebook/docusaurus/issues/7227

We could make it a select instead (ie the navbar element is a button instead of a link) but that would be a different navbar item type with a different ux and configuration, and things to take care of like accessibility.

Some users already do this: https://docs.dyte.io/react-native (open-source site)

CleanShot 2022-12-14 at 16 33 32@2x
Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Dependent Drop-Down List in Word - Fillable Forms ...
HOW TO CREATE A DEPENDENT DROP-DOWN LIST IN MS WORD 365 - LEGACY TOOL DROP DOWN FORM FIELD WITH VISUAL BASIC CODE //...
Read more >
Video: Drop-down list settings - Microsoft Support
You can use a comma-delimited list, a cell range, or a named range to define the options in a drop-down list. This video...
Read more >
Apply sensitivity labels to your files and email in Office
On the Home tab, select Sensitivity. Sensitivity button ¡ Choose the sensitivity label that applies to your file or email. Sensitivity label drop-down...
Read more >
Video: Manage drop-down lists - Microsoft Support
Training: To prevent changes to your drop-down list data, you can hide the columns, rows, or the entire worksheet that contains the data....
Read more >
Dropdowns - Bootstrap
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found