Skip to content

Commit 6ff63b8

Browse files
committed
Merge branch 'main' into vt/nullvoxpopuli
2 parents 43394a0 + e782462 commit 6ff63b8

File tree

100 files changed

+4643
-2205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4643
-2205
lines changed

.lighthouserc.cjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ module.exports = {
3535
chromePath: findChrome(),
3636
puppeteerScript: './lighthouse-setup.cjs',
3737
settings: {
38-
onlyCategories: ['accessibility'],
38+
onlyCategories: process.env.LH_PERF ? ['performance'] : ['accessibility'],
3939
skipAudits: ['valid-source-maps'],
4040
},
4141
},
4242
assert: {
43-
assertions: {
44-
'categories:accessibility': ['error', { minScore: 1 }],
45-
},
43+
assertions: process.env.LH_PERF
44+
? {
45+
'cumulative-layout-shift': ['error', { maxNumericValue: 0 }],
46+
}
47+
: {
48+
'categories:accessibility': ['error', { minScore: 1 }],
49+
},
4650
},
4751
upload: {
4852
target: 'temporary-public-storage',

CONTRIBUTING.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This focus helps guide our project decisions as a community and what we choose t
5454
- [Unit tests](#unit-tests)
5555
- [Component accessibility tests](#component-accessibility-tests)
5656
- [Lighthouse accessibility tests](#lighthouse-accessibility-tests)
57+
- [Lighthouse performance tests](#lighthouse-performance-tests)
5758
- [End to end tests](#end-to-end-tests)
5859
- [Test fixtures (mocking external APIs)](#test-fixtures-mocking-external-apis)
5960
- [Submitting changes](#submitting-changes)
@@ -114,6 +115,7 @@ pnpm test:unit # Unit tests only
114115
pnpm test:nuxt # Nuxt component tests
115116
pnpm test:browser # Playwright E2E tests
116117
pnpm test:a11y # Lighthouse accessibility audits
118+
pnpm test:perf # Lighthouse performance audits (CLS)
117119
```
118120

119121
### Project structure
@@ -641,18 +643,38 @@ pnpm test:a11y:prebuilt
641643

642644
# Or run a single color mode manually
643645
pnpm build:test
644-
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse-a11y.sh
646+
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse.sh
645647
```
646648

647649
This requires Chrome or Chromium to be installed. The script will auto-detect common installation paths. Results are printed to the terminal and saved in `.lighthouseci/`.
648650

649651
#### Configuration
650652

651-
| File | Purpose |
652-
| ---------------------------- | --------------------------------------------------------- |
653-
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
654-
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
655-
| `scripts/lighthouse-a11y.sh` | Shell wrapper that runs the audit for a given color mode |
653+
| File | Purpose |
654+
| ----------------------- | --------------------------------------------------------- |
655+
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
656+
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
657+
| `scripts/lighthouse.sh` | Shell wrapper that runs the audit for a given color mode |
658+
659+
### Lighthouse performance tests
660+
661+
The project also runs Lighthouse performance audits to enforce zero Cumulative Layout Shift (CLS). These run separately from the accessibility audits and test the same set of URLs.
662+
663+
#### How it works
664+
665+
The same `.lighthouserc.cjs` config is shared between accessibility and performance audits. When the `LH_PERF` environment variable is set, the config switches from the `accessibility` category to the `performance` category and asserts that CLS is exactly 0.
666+
667+
#### Running locally
668+
669+
```bash
670+
# Build + run performance audit
671+
pnpm test:perf
672+
673+
# Or against an existing test build
674+
pnpm test:perf:prebuilt
675+
```
676+
677+
Unlike the accessibility audits, performance audits do not run in separate light/dark modes.
656678

657679
### End to end tests
658680

@@ -767,8 +789,10 @@ Format: `type(scope): description`
767789
- `fix(i18n): update French translations`
768790
- `chore(deps): update vite to v6`
769791

792+
Where front end changes are made, please include before and after screenshots in your pull request description.
793+
770794
> [!NOTE]
771-
> The subject must start with a lowercase letter. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
795+
> Use lowercase letters in your pull request title. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
772796
773797
### PR descriptions
774798

app/components/AppFooter.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ const showModal = () => modalRef.value?.showModal?.()
2323
<LinkBase :to="{ name: 'privacy' }">
2424
{{ $t('privacy_policy.title') }}
2525
</LinkBase>
26+
<LinkBase :to="{ name: 'accessibility' }">
27+
{{ $t('a11y.footer_title') }}
28+
</LinkBase>
2629
<button
2730
type="button"
2831
class="cursor-pointer group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"

app/components/AppHeader.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ const mobileLinks = computed<NavigationConfigWithGroups>(() => [
6464
external: false,
6565
iconClass: 'i-carbon:security',
6666
},
67+
{
68+
name: 'Accessibility',
69+
label: $t('a11y.title'),
70+
to: { name: 'accessibility' },
71+
type: 'link',
72+
external: false,
73+
iconClass: 'i-carbon:accessibility-alt',
74+
},
6775
],
6876
},
6977
{

app/components/AppLogo.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ defineProps<{
2424
font-size="420"
2525
font-weight="500"
2626
text-anchor="middle"
27+
style="user-select: none"
2728
>
2829
<tspan>/</tspan>
2930
</text>

app/components/Code/Viewer.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ watch(
5757
},
5858
{ immediate: true },
5959
)
60+
61+
// Use Nuxt's `navigateTo` for the rendered import links
62+
function handleImportLinkNavigate() {
63+
if (!codeRef.value) return
64+
65+
const anchors = codeRef.value.querySelectorAll<HTMLAnchorElement>('a.import-link')
66+
anchors.forEach(anchor => {
67+
// NOTE: We do not need to remove previous listeners because we re-create the entire HTML content on each html update
68+
anchor.addEventListener('click', event => {
69+
if (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) return
70+
const href = anchor.getAttribute('href')
71+
if (href) {
72+
event.preventDefault()
73+
navigateTo(href)
74+
}
75+
})
76+
})
77+
}
78+
79+
watch(
80+
() => props.html,
81+
() => {
82+
nextTick(handleImportLinkNavigate)
83+
},
84+
{ immediate: true },
85+
)
6086
</script>
6187

6288
<template>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import DownloadAnalytics from '../Package/DownloadAnalytics.vue'
2+
import TrendsChart from '../Package/TrendsChart.vue'
33
44
const { packages } = defineProps<{
55
packages: string[]
@@ -8,6 +8,6 @@ const { packages } = defineProps<{
88

99
<template>
1010
<div class="font-mono">
11-
<DownloadAnalytics :package-names="packages" :in-modal="false" />
11+
<TrendsChart :package-names="packages" :in-modal="false" show-facet-selector />
1212
</div>
1313
</template>

app/components/Compare/PackageSelector.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ function handleKeydown(e: KeyboardEvent) {
8989
} else if (hasMatchInPackages) {
9090
addPackage(inputValueTrim)
9191
}
92+
} else if (e.key === 'Escape') {
93+
inputValue.value = ''
9294
}
9395
}
9496
@@ -185,7 +187,7 @@ function handleFocus() {
185187
:aria-label="$t('compare.no_dependency.add_column')"
186188
@click="addPackage(NO_DEPENDENCY_ID)"
187189
>
188-
<span class="text-sm text-accent italic flex items-center gap-2 block">
190+
<span class="text-sm text-accent italic flex items-center gap-2">
189191
<span class="i-carbon:clean w-4 h-4" aria-hidden="true" />
190192
{{ $t('compare.no_dependency.typeahead_title') }}
191193
</span>
@@ -204,7 +206,10 @@ function handleFocus() {
204206
@click="addPackage(result.name)"
205207
>
206208
<span class="font-mono text-sm text-fg block">{{ result.name }}</span>
207-
<span v-if="result.description" class="text-xs text-fg-muted truncate mt-0.5">
209+
<span
210+
v-if="result.description"
211+
class="text-xs text-fg-muted truncate mt-0.5 w-full block"
212+
>
208213
{{ result.description }}
209214
</span>
210215
</ButtonBase>

app/components/Compare/ReplacementSuggestion.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const docUrl = computed(() => {
2525
class="flex items-start gap-2 px-3 py-2 rounded-lg text-sm"
2626
:class="
2727
variant === 'nodep'
28-
? 'bg-amber-500/10 border border-amber-600/30 text-amber-700 dark:text-amber-400'
28+
? 'bg-amber-500/10 border border-amber-600/30 text-amber-800 dark:text-amber-400'
2929
: 'bg-blue-500/10 border border-blue-600/30 text-blue-700 dark:text-blue-400'
3030
"
3131
>

app/components/DependencyPathPopup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function parsePackageString(pkg: string): { name: string; version: string } {
6868
<!-- Path badge button -->
6969
<button
7070
type="button"
71-
class="path-badge font-mono text-3xs px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400 transition-all duration-200 ease-out whitespace-nowrap flex items-center gap-1 hover:bg-amber-500/20 hover:border-amber-500/50"
71+
class="path-badge font-mono text-3xs px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/30 text-amber-800 dark:text-amber-400 transition-all duration-200 ease-out whitespace-nowrap flex items-center gap-1 hover:bg-amber-500/20 hover:border-amber-500/50"
7272
:aria-expanded="isOpen"
7373
@click.stop="togglePopup"
7474
>

0 commit comments

Comments
 (0)