diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/styles.module.css b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/styles.module.css index 9ddd0aa8ba14..b157b2bd1579 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Category/styles.module.css @@ -23,4 +23,5 @@ TODO merge this logic back in Infima? line-clamp: 2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; + padding-bottom: 1px; } diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css index a48f210974ac..6c8cdef36b3a 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/Link/styles.module.css @@ -15,4 +15,5 @@ line-clamp: 2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; + padding-bottom: 1px; } diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/__tests__/index.test.ts b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/__tests__/index.test.ts new file mode 100644 index 000000000000..454b3b9a97fa --- /dev/null +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebarItem/__tests__/index.test.ts @@ -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/); + }); +});