Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}-artifacts
name: test-artifacts-${{ github.run_id }}-${{ github.run_attempt }}
path: |
_playwright-results/
_playwright-report/
2 changes: 2 additions & 0 deletions src/themes/shared/_markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
}

a {
overflow-wrap: anywhere;

&.anchor {
color: inherit;

Expand Down
37 changes: 37 additions & 0 deletions test/e2e/sidebar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,43 @@ test.describe('Sidebar Tests', () => {
});
});

test.describe('Mobile sidebar toggle', () => {
test('wraps long links without causing horizontal overflow', async ({
page,
}) => {
await page.setViewportSize({ width: 390, height: 844 });

const longUrl = `https://example.com/${'a'.repeat(240)}`;
const content = Array.from(
{ length: 80 },
(_, index) => `## Section ${index + 1}\n\nLong content for scrolling.`,
).join('\n\n');

await docsifyInit({
config: {
loadSidebar: '_sidebar.md',
},
markdown: {
homepage: `# Mobile scrolling\n\n${content}\n\n[${longUrl}](${longUrl})`,
sidebar: '- [Mobile scrolling](README.md)',
},
styleURLs: ['/dist/themes/core.css'],
});

await expect
.poll(() => page.evaluate(() => document.documentElement.scrollWidth))
.toBe(page.viewportSize().width);

await page.mouse.wheel(0, 1200);
await expect
.poll(() => page.evaluate(() => window.scrollY))
.toBeGreaterThan(0);

await page.mouse.wheel(0, -1200);
await expect.poll(() => page.evaluate(() => window.scrollY)).toBe(0);
});
});

test.describe('Configuration: autoHeader', () => {
test('autoHeader=false', async ({ page }) => {
const docsifyInitConfig = {
Expand Down