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

Long labels in the sidebar do not display correctly #10531

Open
6 of 7 tasks
shipswake opened this issue Sep 27, 2024 · 15 comments
Open
6 of 7 tasks

Long labels in the sidebar do not display correctly #10531

shipswake opened this issue Sep 27, 2024 · 15 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: theme Related to the default theme components

Comments

@shipswake
Copy link

Have you read the Contributing Guidelines on issues?

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

I have sidebar items auto generated with @grapql-markdown
Some of the labels in the sidebar are very long and cannot be fully seen

image

It would be very helpful for the long labels to be truncated with an ellipse and a tooltip added so the full label can be seen on hover

Reproducible demo

No response

Steps to reproduce

Create a new Docusaurus site
Create content which has very long labels in the sidebar

The labels are hidden behind the page view

Expected behavior

Would like to see the labels truncated with an ellipse and a tooltip displayed on hover of the label

Actual behavior

The long labels in the sidebar are hidden by the page

Your environment

  • Public source code: none
  • Public site URL: none
  • Docusaurus version used: latest
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Edge
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 10

Self-service

  • I'd be willing to fix this bug myself.
@shipswake shipswake added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Sep 27, 2024
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Sep 27, 2024
@PranavKeshav24

This comment was marked as spam.

@slorber
Copy link
Collaborator

slorber commented Oct 3, 2024

@PranavKeshav24 you can already start working on it. We only assign an issue after you open a draft PR showing you are capable of solving the problem.

@slorber
Copy link
Collaborator

slorber commented Oct 3, 2024

cc @pwizla I remember seeing Strapi docs also truncating sidebar labels, maybe that could serve as an inspiration for the CSS to use to solve this

https://docs.strapi.io/dev-docs/api/document-service

CleanShot 2024-10-03 at 11 35 53

@pwizla
Copy link

pwizla commented Oct 3, 2024

Thank you for the heads-up, @slorber! This comment is timely as I'm completely reworking the style of Strapi docs. 😄

@PranavKeshav24 Here's what did the trick for us, if you simply want to truncate the content: https://github.com/strapi/documentation/blob/main/docusaurus/src/scss/sidebar.scss#L139-L140 (and you might not even need the white-space property, we have it because we sometimes add labels to the sidebar items).

@Sanjoy-droid
Copy link

@shipswake could you be more specific on how to reproduce the issue? I was not able to reproduce the bug

@shipswake
Copy link
Author

From above:
image

If you have a very long label in the sidebar the label will be hidden behind the page

The label should be truncated with an ellipsis and the full label readable in a tooltip when hovering over the label.

Here is the discussion:
#10529

@Josh-Cena Josh-Cena added the domain: theme Related to the default theme components label Oct 4, 2024
@PranavKeshav24
Copy link

Thank you for the heads-up, @slorber! This comment is timely as I'm completely reworking the style of Strapi docs. 😄

@PranavKeshav24 Here's what did the trick for us, if you simply want to truncate the content: https://github.com/strapi/documentation/blob/main/docusaurus/src/scss/sidebar.scss#L139-L140 (and you might not even need the white-space property, we have it because we sometimes add labels to the sidebar items).

Thank you so much for sharing that. 😄

@Shrasingh

This comment was marked as spam.

@PrinceACS

This comment was marked as spam.

@omchaudhary007

This comment was marked as spam.

@omchaudhary007

This comment was marked as spam.

@YoosufAathil

This comment was marked as spam.

@krVatsal

This comment was marked as spam.

@shipswake
Copy link
Author

Any update on this?

@Josh-Cena
Copy link
Collaborator

Any update is visible in this thread. No PR means no progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution domain: theme Related to the default theme components
Projects
None yet
Development

No branches or pull requests