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
434 changes: 183 additions & 251 deletions bun.lock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions e2e/shell.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ test('the toolbar offers search by field and shortcut', async ({ page }) => {
await expect(search).toHaveAttribute('aria-keyshortcuts', 'Meta+K Control+K')
})

test('the search field is named by its own text, so the name starts with the word it shows', async ({ page }) => {
for (const width of [390, 1280]) {
await page.setViewportSize({ width, height: 900 })
await page.goto('/docs/latest/guards')
const search = page.locator('[data-toolbar]:visible [data-search-trigger]')
await expect(search).toHaveAccessibleName('Search the documentation')
await expect(search).not.toHaveAttribute('aria-label')
}
})

test.describe('nothing spills past the reading column', () => {
const pages = ['/', '/docs/latest/guards', '/docs/latest/api/decorator/Command', '/docs/latest/changelog']
for (const width of [390, 1280, 2560]) {
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,50 +61,50 @@
"shiki": "^4.6.0"
},
"devDependencies": {
"@axe-core/playwright": "^4.13.0",
"@axe-core/playwright": "^4.14.0",
"@fontsource-variable/instrument-sans": "^5.3.0",
"@fontsource-variable/jetbrains-mono": "^5.3.0",
"@meonode/compiler": "^0.10.4",
"@next/eslint-plugin-next": "^16.4.6",
"@playwright/test": "^1.63.0",
"@sigstore/bundle": "^5.0.0",
"@playwright/test": "^1.65.1",
"@sigstore/bundle": "^5.0.1",
"@sigstore/protobuf-specs": "^0.5.2",
"@sigstore/tuf": "^5.0.0",
"@sigstore/verify": "^4.1.2",
"@sigstore/tuf": "^5.0.1",
"@sigstore/verify": "^4.1.3",
"@swc/wasm-web": "^1.16.22",
"@types/bun": "^1.4.2",
"@types/bun": "^1.4.5",
"@types/mdast": "^4.0.4",
"@types/node": "^26.6.2",
"@types/node": "^26.6.6",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@types/semver": "^7.8.0",
"@vitest/coverage-istanbul": "^5.0.5",
"@vitest/coverage-istanbul": "5.1.0",
"babel-plugin-react-compiler": "^1.0.0",
"buffer": "^6.0.3",
"discord.js": "^14.28.1",
"dotenv": "^18.0.5",
"dotenv": "^18.0.10",
"esbuild": "^0.28.2",
"eslint": "^10.11.0",
"eslint": "^10.15.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-prettier": "^5.5.7",
"eslint-plugin-unused-imports": "^4.4.1",
"events": "^3.3.0",
"github-slugger": "^2.0.0",
"happy-dom": "^20.14.5",
"husky": "^9.1.7",
"lighthouse": "^13.5.0",
"lighthouse": "^13.6.0",
"pagefind": "^1.6.0",
"path-browserify": "^1.0.1",
"prettier": "^3.9.9",
"prettier": "^3.10.1",
"process": "^0.11.10",
"schema-dts": "^2.1.0",
"semver": "^7.8.5",
"semver": "^7.8.6",
"string_decoder": "^1.3.0",
"typedoc": "^0.28.20",
"typescript": "6.0.3",
"typescript-eslint": "^8.70.1",
"typescript-eslint": "^8.73.0",
"util": "^0.12.5",
"vitest": "^5.0.5",
"vitest": "5.1.0",
"yaml": "^2.9.1"
}
}
14 changes: 2 additions & 12 deletions src/components/shell/SidebarFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { type ChangeEvent, type KeyboardEvent, useRef, useState } from 'react'
import { Component, Div, Input, P } from '@meonode/ui'
import { focusCss } from '@/lib/design/css'
import { focusCss, visuallyHiddenCss } from '@/lib/design/css'

/** A title as a reader types it: letter case and accents aside, so "resume" finds "Résumé". */
const folded = (text: string) =>
Expand All @@ -18,16 +18,6 @@ function scrollerOf(element: Element): HTMLElement | null {
return null
}

/** Out of sight but read aloud: the status while it counts the pages shown. */
const countHidden = {
position: 'absolute',
width: 1,
height: 1,
overflow: 'hidden',
clipPath: 'inset(50%)',
whiteSpace: 'nowrap',
} as const

/**
* Narrows the sidebar's links to those whose title holds what is typed, keeping each match's group and
* category, and says how many pages show, or that none does. The matches show from the top, and
Expand Down Expand Up @@ -122,7 +112,7 @@ export const SidebarFilter = Component(function SidebarFilter() {
role: 'status',
margin: count === 0 ? 'theme.space.2 theme.space.2 0' : 0,
// A count is for a screen reader: shown, it would deepen the pinned bar over the rows it keeps clear
...(count ? countHidden : {}),
...(count ? visuallyHiddenCss : {}),
fontSize: 'theme.type.small.size',
color: 'theme.ink.secondary',
}),
Expand Down
8 changes: 5 additions & 3 deletions src/components/shell/Toolbar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, For, Kbd, Li, Nav, Node, Ol, Span } from '@meonode/ui'
import { earFlickCss } from '@/lib/brand/ear-flick'
import { focusCss, touchCss, transitionCss } from '@/lib/design/css'
import { focusCss, touchCss, transitionCss, visuallyHiddenCss } from '@/lib/design/css'
import { Mark } from '@/components/shell/brand'
import { GlyphSlot } from '@/components/shell/glyph-slot'
import { Glyph } from '@/components/shell/icons'
Expand Down Expand Up @@ -77,6 +77,8 @@ function Breadcrumbs(crumbs: Crumb[]) {
/**
* The search field: a button drawn as a field, which opens the command palette. It carries
* `data-search-trigger` for the palette's island to find, and shows the shortcut it answers to.
* Its text names it, "Search the documentation" with the last words hidden, so the name starts with
* the word it shows; below the compact width the word is hidden too, not removed.
*/
function SearchField() {
return Button(
Expand All @@ -86,8 +88,9 @@ function SearchField() {
key: 'label',
flexGrow: 1,
textAlign: 'left',
css: { '@media (width < theme.breakpoint.compact)': { display: 'none' } },
css: { '@media (width < theme.breakpoint.compact)': visuallyHiddenCss },
}),
Span(' the documentation', { key: 'rest', ...visuallyHiddenCss }),
Kbd('⌘K', {
key: 'shortcut',
'aria-hidden': true,
Expand All @@ -97,7 +100,6 @@ function SearchField() {
{
type: 'button',
'data-search-trigger': true,
'aria-label': 'Search the documentation',
'aria-keyshortcuts': 'Meta+K Control+K',
display: 'inline-flex',
alignItems: 'center',
Expand Down
10 changes: 10 additions & 0 deletions src/lib/design/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export function materialCss(level: MaterialLevel): ThemedCSSObject {
}
}

/** Out of sight but read aloud: in the accessibility tree and the page's text, drawn nowhere. */
export const visuallyHiddenCss = {
position: 'absolute',
width: 1,
height: 1,
overflow: 'hidden',
clipPath: 'inset(50%)',
whiteSpace: 'nowrap',
} as const satisfies ThemedCSSObject

/** The focus ring: 2px of accent, 2px out, with a halo. It replaces the outline, never removes it. */
export const focusCss: ThemedCSSObject = {
'&:focus-visible': {
Expand Down
25 changes: 25 additions & 0 deletions tests/vitest-bun-pin.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { spawnSync } from 'node:child_process'
import { describe, expect, it } from 'vitest'

// vitest is held at 5.1.0: 5.1.1's forks pool calls child.channel.unref(), which Bun's IPC channel lacks
// (oven-sh/bun#33593), and examples:check runs vitest under Bun's runtime, where 5.1.1 can't start its workers.
// A vitest release with vitest-dev/vitest#12039 (`child.channel?.unref?.()`) lifts it too, which this spec can't
// see: check vitest's changelog on each bump
const BUN = process.versions.bun ? process.execPath : 'bun'
const PROBE = `
import { spawn } from 'node:child_process'
const child = spawn(process.execPath, ['-e', '0'], { stdio: ['ignore', 'ignore', 'ignore', 'ipc'] })
console.log(typeof child.channel?.unref)
child.kill()
`

describe('vitest pin', () => {
it("holds while Bun's IPC channel has no unref", () => {
const result = spawnSync(BUN, ['-e', PROBE], { encoding: 'utf8' })
expect(result.status, result.stderr).toBe(0)
expect(
result.stdout.trim(),
'Bun has channel.unref now: move vitest and @vitest/coverage-istanbul to their latest and delete this spec',
).toBe('undefined')
})
})
Loading