-
Notifications
You must be signed in to change notification settings - Fork 374
docs: raise mobile table-cell touch target to 44px, add scroll-wrapper coverage tests #28786
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,52 @@ test.describe('Mobile and Responsive Layout', () => { | |
| await context.close(); | ||
| }); | ||
|
|
||
| test('should wrap ALL markdown tables in a scroll wrapper on the engines reference page', async ({ browser }) => { | ||
| const context = await browser.newContext({ | ||
| javaScriptEnabled: false, | ||
| viewport: { width: 768, height: 1024 }, | ||
| }); | ||
| const page = await context.newPage(); | ||
|
Comment on lines
+57
to
+61
|
||
|
|
||
| await page.goto('/gh-aw/reference/engines/'); | ||
| await page.waitForLoadState('domcontentloaded'); | ||
|
|
||
| // Count all tables in markdown content area | ||
| const tableCount = await page.locator('.sl-markdown-content table').count(); | ||
| expect(tableCount).toBeGreaterThan(0); | ||
|
|
||
| // Count tables that are direct children of .table-scroll-wrapper | ||
| const wrappedTableCount = await page.locator('.sl-markdown-content .table-scroll-wrapper > table').count(); | ||
|
|
||
| // Every table must have a scroll wrapper for consistent horizontal scrolling on all viewports | ||
| expect(wrappedTableCount).toBe(tableCount); | ||
|
|
||
|
Comment on lines
+66
to
+75
|
||
| await context.close(); | ||
| }); | ||
|
|
||
| test('should have WCAG 2.5.5-compliant touch target size for mobile table cells', async ({ browser }) => { | ||
| const context = await browser.newContext({ | ||
| javaScriptEnabled: true, | ||
| viewport: { width: 390, height: 844 }, | ||
| }); | ||
| const page = await context.newPage(); | ||
|
|
||
| await page.goto('/gh-aw/reference/engines/'); | ||
| await page.waitForLoadState('networkidle'); | ||
|
|
||
| // On mobile (<=640px), table cells are rendered as stacked cards. | ||
| // Each cell must meet the WCAG 2.5.5 AAA minimum touch target of 44 px (2.75 rem). | ||
| const tdMinHeight = await page.evaluate(() => { | ||
| const td = document.querySelector('.sl-markdown-content table tbody td'); | ||
| if (!td) return 0; | ||
| return parseFloat(getComputedStyle(td).minHeight); | ||
| }); | ||
|
|
||
| expect(tdMinHeight).toBeGreaterThanOrEqual(44); | ||
|
|
||
| await context.close(); | ||
| }); | ||
|
|
||
| for (const formFactor of formFactors) { | ||
| test.describe(`${formFactor.name}`, () => { | ||
| test.beforeEach(async ({ page }) => { | ||
|
|
||
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.
Using
2.75remonly guarantees a 44px minimum if the root font size is 16px; if the base font size is adjusted, the touch target could drop below 44px. To enforce the WCAG 2.5.5 44px minimum regardless of root sizing, considermin-height: 44px(ormin-height: max(44px, 2.75rem)if you still want rem-based scaling).