Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply menu__link--sublist consistently to fix Docusaurus search issue #227

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Mar 24, 2022

We should apply consistently the menu__link--sublist on category items (with/without link) otherwise it breaks search feature on all sites that are using category links

image

Introduce a new menu__link--sublist-caret class to add back the caret feature only when the class is added (otherwise it shows duplicate caret: button + CSS)


We'll find a way to create stable selectors for the crawler, but for now it's simpler to be retro compatible with all the existing search configs and ensure the current Algolia crawler selector keeps working

const lvl0 =
          $(
            ".menu__link.menu__link--sublist.menu__link--active, .navbar__item.navbar__link--active"
          )
            .last()
            .text() || "Documentation";

        return helpers.docsearch({
          recordProps: {
            lvl0: {
              selectors: "",
              defaultValue: lvl0,
            },
            lvl1: "header h1",
            lvl2: "article h2",
            lvl3: "article h3",
            lvl4: "article h4",
            lvl5: "article h5, article td:first-child",
            lvl6: "article h6",
            content: "article p, article li, article td:last-child",
          },
          indexHeadings: true,
        });

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 24, 2022
@github-actions
Copy link

Dist CSS Diff

diff --git a/packages/core/dist/css/default/default.css b/packages/core/dist-branch/css/default/default.css
index c8ffbe1..7055171 100644
--- a/packages/core/dist/css/default/default.css
+++ b/packages/core/dist-branch/css/default/default.css
@@ -2454,11 +2454,11 @@ hr {
       transition: color var(--ifm-transition-fast) var(--ifm-transition-timing-default);
     }
 
-.menu__link--sublist {
+.menu__link--sublist-caret {
       justify-content: space-between;
     }
 
-.menu__link--sublist:after {
+.menu__link--sublist-caret:after {
         content: '';
         min-width: 1.25rem;
         background: var(--ifm-menu-link-sublist-icon) 50% / 2rem 2rem;

@github-actions
Copy link

Size Change: +96 B (0%)

Total Size: 579 kB

Filename Size Change
./packages/core/dist/css/default-dark/default-dark-rtl.css 84.1 kB +12 B (0%)
./packages/core/dist/css/default-dark/default-dark-rtl.min.css 59 kB +12 B (0%)
./packages/core/dist/css/default-dark/default-dark.css 84 kB +12 B (0%)
./packages/core/dist/css/default-dark/default-dark.min.css 59 kB +12 B (0%)
./packages/core/dist/css/default/default-rtl.css 82 kB +12 B (0%)
./packages/core/dist/css/default/default-rtl.min.css 57.8 kB +12 B (0%)
./packages/core/dist/css/default/default.css 82 kB +12 B (0%)
./packages/core/dist/css/default/default.min.css 57.8 kB +12 B (0%)
ℹ️ View Unchanged
Filename Size
./packages/core/dist/js/alerts.js 409 B
./packages/core/dist/js/alerts.min.js 409 B
./packages/core/dist/js/button-groups.js 267 B
./packages/core/dist/js/button-groups.min.js 267 B
./packages/core/dist/js/dropdowns.js 1.01 kB
./packages/core/dist/js/dropdowns.min.js 1.01 kB
./packages/core/dist/js/menu.js 2.4 kB
./packages/core/dist/js/menu.min.js 2.4 kB
./packages/core/dist/js/navbar.js 1.08 kB
./packages/core/dist/js/navbar.min.js 1.08 kB
./packages/core/dist/js/pills.js 270 B
./packages/core/dist/js/pills.min.js 270 B
./packages/core/dist/js/radio-behavior.js 705 B
./packages/core/dist/js/radio-behavior.min.js 705 B
./packages/core/dist/js/tabs.js 267 B
./packages/core/dist/js/tabs.min.js 267 B

compressed-size-action

@netlify
Copy link

netlify bot commented Mar 24, 2022

Deploy Preview for infima ready!

Name Link
🔨 Latest commit 0b638dc
🔍 Latest deploy log https://app.netlify.com/sites/infima/deploys/623c79289415b7000af42031
😎 Deploy Preview https://deploy-preview-227--infima.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@slorber slorber changed the title Apply menu__link--sublist consistently to fix Docusaurus search issue fix: apply menu__link--sublist consistently to fix Docusaurus search issue Mar 24, 2022
@slorber slorber merged commit 7510e54 into main Mar 24, 2022
@slorber slorber deleted the slorber/restore-category-sublist branch March 24, 2022 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants