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.

localeDropdown treated as a link instead of a dropdown

See original GitHub issue

I apologize, I can’t reproduce our environment

🐛 Bug Report

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.
  • I have tried creating a repro with https://new.docusaurus.io
  • [X ] I have read the console error message carefully (if applicable)

Description

After updating the docusaurus version from 2.0.0-alpha.75 to 2.0.0-beta.6 the dropdown menu displaying the locales is suddenly a link. There is no longer a dropdown menu available.

Have you read the Contributing Guidelines on issues?

Yes I did.

Steps to reproduce

Our environment is build through docker. The behavior for our default language version is slightly different then usual. In our setup we want that the defaultlocale is ALWAYS shown as part of the BASEURL, unlike the default behavior where this is not part of the baseURL, hance we pass an environment variable to our docusaurus config, which holds this baseURL for English and German. See below. we use the following command to build our environment "build_i18n": "cross-env LOCALE='en' BASE_URL='/adonis/en/' docusaurus build --locale en --out-dir build/en && cross-env LOCALE='de' BASE_URL='/adonis/de/' docusaurus build --locale de --out-dir build/de", The above is located in package.json this should be irrelevant, but this is the reason why I have difficulties creating a sandbox at the moment, due to the control of the output directory.

With the setup above we build to 2 directories, one for english and one for german. And so we always have the locale part of the URL even if your browse to the default language of the website.

Note, the commands are all working fine, and when I change the base URL from https://dev-docs.boc-group.com/adonis/en/ to https://dev-docs.boc-group.com/adonis/de/ then this also works like it always did. So no problems so far. But the localeDropdown is simply not showing correctly anymore with this version of docusarus while nothing has changed in our setup at all.

Below is our docusaurus.config.js

const currentVersion = '13.0';
const previousVersion = '12.0';
// TODO remove previousVersion once HW_SW_RQ and EOM are present in 13.0
const privacy_policy = `<p class="copyright_span">Copyright © ${new Date().getFullYear()} BOC Products & Services AG. All rights reserved. - <a href="https://www.boc-group.com/en/privacy-policy/">Privacy Policy</a></p>`
const locale = process.env.LOCALE;
module.exports = {
    title: "ADONIS",
    tagline: "Welcome to the ADONIS Help.",
    url: "https://docs.boc-group.com",
    baseUrl: process.env.BASE_URL,
    onBrokenLinks: "warn",
    favicon: "img/boc/favicon.svg",
    organizationName: "BOC Products & Services AG.",
    projectName: "adonis-docs-portal",
    i18n: {
        defaultLocale: 'en',
        locales: ['en', 'de'],
    },
    customFields: {
        envLocale: locale,
    },
    themeConfig: {
        // https://github.com/algolia/docsearch-configs/blob/master/configs/boc-group.json
        algolia: {
            apiKey: '3acb8d1e2dca055840337e29fa9be493',
            indexName: 'boc-group',
            contextualSearch: true,
            searchParameters: {
                // https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/
                facetFilters: ["tags:adonis"]
            },
        },
        navbar: {
            hideOnScroll: true,
            logo: {
                alt: "Adonis Logo",
                src: "img/boc/ADONIS_Generic.svg",
            },
            items: [
                {
                    type: 'doc',
                    label: 'User Manual',
                    position: 'right',
                    docId: 'user_manual/pre-000000',
                },
                {
                    to: "adminBooks/",
                    label: "Administrator Manuals",
                    position: "right",
                    activeBaseRegex: 'adminBooks|installation_manual|administration_manual',
                },
                {
                    to: "new/",
                    label: "What's New",
                    position: "right",
                    activeBaseRegex: 'new|news',
                },
                {
                    type: 'localeDropdown',
                    position: "right"
                },
                {
                    type: 'docsVersionDropdown',
                    position: "right"
                },
            ],
        },
        footer: {
            style: "light",
            links: [{
                title: "Docs",
                items: [
                    {
                        label: "What's New",
                        to: "new/",
                    },
                    {
                        label: "User Manual",
                        to: "docs/" + currentVersion + "/user_manual/",
                    },
                    {
                        label: "Administration Manual",
                        to: "docs/" + currentVersion + "/administration_manual/",
                    },
                    {
                        label: "Installation Manual",
                        to: "docs/" + currentVersion + "/installation_manual/",
                    },
                    {
                        label: "Hardware/Software Requirements",
                        to: "docs/" + previousVersion + "/hw-sw-reqs/",
                    },
                    {
                        label: "End of Maintenance Information",
                        to: "docs/" + previousVersion + "/eom/",
                    },
                ],
            },
            {
                title: "Community",
                items: [{
                    label: "Twitter",
                    href: "https://twitter.com/BOC_Group",
                },
                {
                    label: "LinkedIn",
                    href: "https://www.linkedin.com/company/boc-products-and-services-ag",
                },
                ],
            },
            {
                title: "More",
                items: [
                    {
                        label: "BOC Group",
                        href: "https://www.boc-group.com/" + locale + "/",
                    },
                    {
                        label: "ADONIS BPM Suite",
                        href: "https://www.boc-group.com/" + locale + "/adonis/",
                    },
                    {
                        label: "Latest Product Release",
                        href: "https://www.boc-group.com/" + locale + "/adonis/whats-new/",
                    },
                    {
                        label: "Marketplace",
                        href: "https://knowledge.boc-group.com/" + locale + "/marketplace/adonis/",
                    },
                    {
                        label: "Knowledge Hub",
                        href: "https://knowledge.boc-group.com/" + locale + "/#/?t=bpm",
                    },
                    {
                        label: "Developer Portal",
                        href: "https://developer.boc-group.com/adoxx/en/",
                    },
                ],
            },
            ],
            copyright: privacy_policy,

        },
        colorMode: {
            // "light" | "dark"
            defaultMode: 'light',
            // Hides the switch in the navbar
            // Useful if you want to support a single color mode
            disableSwitch: true,
        },
    },
    scripts: [
        // ------------ COOKIEFIRST ------------
        {
            src: "https://consent.cookiefirst.com/banner.js",
            'data-cookiefirst-key': "50c93cd5-ca3f-473b-91a3-f4b8fde70dd8",
            'data-language': "inherit",
        },
    ],
    presets: [
        [
            "@docusaurus/preset-classic",
            {
                docs: {
                    sidebarPath: require.resolve('./sidebars.js'),
                    lastVersion: "current",
                    versions: {
                        "current": {
                            "label": currentVersion,
                            "path": currentVersion
                        }
                    }
                },
                blog: {
                    showReadingTime: true,
                    // Please change this to your repo.
                    // editUrl:
                    //   '',
                },
                theme: {
                    customCss: require.resolve("./src/css/custom.css"),
                },
            },
        ],
    ],
    plugins: [
        // require.resolve("docusaurus-lunr-search"),
        [
            '@docusaurus/plugin-content-docs',
            {
                id: 'modules',
                path: 'modules/COIS',
                routeBasePath: 'modules/COIS',
                sidebarPath: require.resolve('./modules/COIS/cois_sidebar.js'),
                // ... other options
                // https://docusaurus.io/docs/docs-multi-instance
            },
        ],
    ],
};

This is a picture of the navbar: image

This is a picture displaying that the Link is propagated with the correct items nonetheless. (I used the react components extension for devtools.) image or the JSON

{
  "href": "#",
  "className": "navbar__item navbar__link",
  "items": [
    {
      "isNavLink": true,
      "label": "English",
      "to": "pathname:///adonis/en/docs/12.0/user_manual/",
      "target": "_self",
      "autoAddBaseUrl": false,
      "className": "dropdown__link--active",
      "style": {
        "textTransform": "capitalize"
      }
    },
    {
      "isNavLink": true,
      "label": "Deutsch",
      "to": "pathname:///adonis/de/docs/12.0/user_manual/",
      "target": "_self",
      "autoAddBaseUrl": false,
      "className": "",
      "style": {
        "textTransform": "capitalize"
      }
    }
  ],
  "children": "<span />"
}

Expected behavior

I expected to have a localeDropdown menu as it did in alpha.75 There are no console errors during the build. There are no console errors in the devtools console window of google chrome

Your environment

  • Public source code: /
  • Public URL https://docs.boc-group.com/adonis/en/ however, the error is not available here, only in stage which is not accessible to public.
  • 2.0.0-beta.6
  • Windows 10 Pro

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Josh-Cenacommented, Oct 14, 2021

Yeah, because previously there was nothing as DropdownNavbarItem, and DefaultNavbarItem with items automatically became a dropdown 😉

It changed a few versions ago

0reactions
slorbercommented, Oct 14, 2021

yeah 🤪 was refactored quite a bit recently

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use localeDropdown in footer? · Discussion #5957
Our navbar used up almost all space for normal links. It's better to have locale dropdown in footer or somewhere else.
Read more >
Docusaurus language dropdown display issue
I am using Docusaurus i18n integration to add the language dropdown to site, but it shows weired enter image description here.
Read more >
Hyper link when user select one option on dropdown field
Hello community leaders, We have requirement, that in the catalog form when user select one value "XXX" under category(dropdown) variable.
Read more >
DropdownMenu - dbc docs - Dash Bootstrap Components
Use DropdownMenu to organise lists of links and buttons into a toggleable ... Note: our DropdownMenu is an analogue of Bootstrap's Dropdown component....
Read more >
Linking sheets through dropdown box
Is it possible to create a dropdown box which draws it's items from the primary column of ... Have you considered using Contact...
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