Repository navigation
fix(theme-classic): prevent descender clipping in sidebar labels on Firefox #12922
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
Open
AdamMagued
wants to merge
1
commit into
meta:main
Choose a base branch
from
AdamMagued:fix-sidebar-label-descender-clipping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+30
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,5 @@ | |
| line-clamp: 2; | ||
| -webkit-box-orient: vertical; | ||
| -webkit-line-clamp: 2; | ||
| padding-bottom: 1px; | ||
| } | ||
28 changes: 28 additions & 0 deletions
28
packages/docusaurus-theme-classic/src/theme/DocSidebarItem/__tests__/index.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import {describe, expect, it} from 'vitest'; | ||
|
|
||
| describe('DocSidebarItem label styles', () => { | ||
| it('DocSidebarItem/Link contains bottom padding to prevent Firefox descender clipping', () => { | ||
| const cssPath = path.resolve(__dirname, '../Link/styles.module.css'); | ||
| const cssContent = fs.readFileSync(cssPath, 'utf8'); | ||
|
|
||
| expect(cssContent).toMatch(/\.linkLabel\s*\{[^}]*line-clamp:\s*2/); | ||
| expect(cssContent).toMatch(/\.linkLabel\s*\{[^}]*padding-bottom:\s*1px/); | ||
| }); | ||
|
|
||
| it('DocSidebarItem/Category contains bottom padding to prevent Firefox descender clipping', () => { | ||
| const cssPath = path.resolve(__dirname, '../Category/styles.module.css'); | ||
| const cssContent = fs.readFileSync(cssPath, 'utf8'); | ||
|
|
||
| expect(cssContent).toMatch(/\.categoryLinkLabel\s*\{[^}]*line-clamp:\s*2/); | ||
| expect(cssContent).toMatch(/\.categoryLinkLabel\s*\{[^}]*padding-bottom:\s*1px/); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: meta/docusaurus
Length of output: 1852
Script executed:
Repository: meta/docusaurus
Length of output: 19641
Web query:
CSS -webkit-line-clamp padding extra lines visible padding browser legacy line clamp specificationResult:
Web query:
site:github.com/w3c/csswg-drafts webkit line clamp padding bottom overflow hidden third line padding boxResult:
Web query:
site:developer.chrome.com line clamp padding overflow hidden padding box extra lines -webkit-line-clampResult:
Web query:
CSS overflow hidden clipped padding box W3C specification overflow clip edgeResult:
Script executed:
Repository: meta/docusaurus
Length of output: 4839
Web query:
site:issues.chromium.org "-webkit-line-clamp" "padding" extra line text overflow hiddenResult:
Web query:
site:bugzilla.mozilla.org "-webkit-line-clamp" "padding" third line overflow hiddenResult:
Web query:
site:github.com/w3c/csswg-drafts "line-clamp" "padding" "lines" hiddenResult:
Script executed:
Repository: meta/docusaurus
Length of output: 6114
Script executed:
Repository: meta/docusaurus
Length of output: 9019
Keep third-line fragments out of the padding.
With tightly spaced fonts, a label that wraps to three lines can show part of the third line in the new padding. This affects category labels too. Preserve the descender clearance without exposing clamped text.