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(v2): hide mobile collapsible doc toc if no headings #5172

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jul 15, 2021

Motivation

When a page has no heading (empty toc), we should not display the mobile collapsible toc button because it does not reveal any TOC.

Problem can be seen on:

image

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

preview

Related PRs

#4273

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Jul 15, 2021
@slorber slorber requested a review from lex111 as a code owner July 15, 2021 07:28
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jul 15, 2021
@netlify
Copy link

netlify bot commented Jul 15, 2021

✔️ [V2]

🔨 Explore the source changes: b634af1

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60efe3b5907db8000853bb53

😎 Browse the preview: https://deploy-preview-5172--docusaurus-2.netlify.app

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 61
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5172--docusaurus-2.netlify.app/

@github-actions
Copy link

Size Change: -484 B (0%)

Total Size: 850 kB

Filename Size Change
website/build/docs-tests/index.html 20.3 kB -242 B (-1%)
website/build/docs-tests/standalone/index.html 18.8 kB -242 B (-1%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 58.8 kB
website/build/assets/css/styles.********.css 89 kB
website/build/assets/js/main.********.js 459 kB
website/build/blog/2017/12/14/introducing-docusaurus/index.html 62.4 kB
website/build/blog/index.html 26.3 kB
website/build/docs/index.html 40.2 kB
website/build/docs/installation/index.html 47.9 kB
website/build/index.html 27.3 kB

compressed-size-action

@slorber slorber merged commit 0851e0e into master Jul 15, 2021
@slorber
Copy link
Collaborator Author

slorber commented Jul 15, 2021

@lex111 @sw-yx was wondering

Is it fine to have some pages not having that component? Could user be confused about why some pages have the mobile TOC and not others?

For consistency, should we keep displaying the collapsible and display something like "Empty table of contents" when uncollapsing?

@lex111
Copy link
Contributor

lex111 commented Jul 15, 2021

Of course, it's perfectly all right, why not? The user will probably realize that if there is no collapsible element, then there is no TOC for that page.

@slorber
Copy link
Collaborator Author

slorber commented Jul 15, 2021

ok let's keep it that way then ;)

@swyxio
Copy link
Contributor

swyxio commented Aug 3, 2021

sorry @slorber didn't see this message til now - i personally would have voted the opposite way, when there is no TOC, dont show the component. not a big deal but thats my preference, if its useless dont show it

@slorber
Copy link
Collaborator Author

slorber commented Aug 4, 2021

@sw-yx it's what I did with this PR, just upgrade/reswizzle and the empty toc on glossary page should be gone

@swyxio
Copy link
Contributor

swyxio commented Aug 9, 2021

oh! awesome

@slorber slorber deleted the slorber/fix-empty-collapsible-mobile-toc branch August 17, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants