Skip to content

Commit 5f46f9d

Browse files
committed
Merge branch 'main' into feat/more-badges
2 parents c54459b + 20c1464 commit 5f46f9d

File tree

217 files changed

+12644
-3689
lines changed

Some content is hidden

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

217 files changed

+12644
-3689
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ jobs:
139139
run: pnpm install
140140

141141
- name: 🔍 Check for unused code
142-
run: pnpm knip:production
142+
run: pnpm knip

.oxfmtrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "./node_modules/oxfmt/configuration_schema.json",
2+
"$schema": "https://unpkg.com/oxfmt/configuration_schema.json",
33
"semi": false,
44
"singleQuote": true,
55
"arrowParens": "avoid",

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "./node_modules/oxlint/configuration_schema.json",
2+
"$schema": "https://unpkg.com/oxlint/configuration_schema.json",
33
"plugins": ["unicorn", "typescript", "oxc", "vue", "vitest"],
44
"categories": {
55
"correctness": "error",

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["oxc.oxc-vscode", "Vue.volar", "lokalise.i18n-ally"]
2+
"recommendations": ["oxc.oxc-vscode", "Vue.volar", "lokalise.i18n-ally", "antfu.unocss"]
33
}

CONTRIBUTING.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ import { hasProtocol } from 'ufo'
187187

188188
| Type | Convention | Example |
189189
| ---------------- | ------------------------ | ------------------------------ |
190-
| Vue components | PascalCase | `MarkdownText.vue` |
190+
| Vue components | PascalCase | `DateTime.vue` |
191191
| Pages | kebab-case | `search.vue`, `[...name].vue` |
192192
| Composables | camelCase + `use` prefix | `useNpmRegistry.ts` |
193193
| Server routes | kebab-case + method | `search.get.ts` |
@@ -409,10 +409,10 @@ describe('featureName', () => {
409409
410410
### Component accessibility tests
411411

412-
All new components should have a basic accessibility test in `test/nuxt/components.spec.ts`. These tests use [axe-core](https://github.com/dequelabs/axe-core) to catch common accessibility violations.
412+
All Vue components should have accessibility tests in `test/nuxt/a11y.spec.ts`. These tests use [axe-core](https://github.com/dequelabs/axe-core) to catch common accessibility violations and run in a real browser environment via Playwright.
413413

414414
```typescript
415-
import MyComponent from '~/components/MyComponent.vue'
415+
import { MyComponent } from '#components'
416416

417417
describe('MyComponent', () => {
418418
it('should have no accessibility violations', async () => {
@@ -429,6 +429,8 @@ describe('MyComponent', () => {
429429

430430
The `runAxe` helper handles DOM isolation and disables page-level rules that don't apply to isolated component testing.
431431

432+
A coverage test in `test/unit/a11y-component-coverage.spec.ts` ensures all components are either tested or explicitly skipped with justification. When you add a new component, this test will fail until you add accessibility tests for it.
433+
432434
> [!IMPORTANT]
433435
> Just because axe-core doesn't find any obvious issues, it does not mean a component is accessible. Please do additional checks and use best practices.
434436

app/app.vue

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { Directions } from '@nuxtjs/i18n'
33
import { useEventListener } from '@vueuse/core'
4+
import { isEditableElement } from '~/utils/input'
45
56
const route = useRoute()
67
const router = useRouter()
@@ -39,14 +40,9 @@ if (import.meta.server) {
3940
// "/" focuses search or navigates to search page
4041
// "?" highlights all keyboard shortcut elements
4142
function handleGlobalKeydown(e: KeyboardEvent) {
42-
const target = e.target as HTMLElement
43-
44-
const isEditableTarget =
45-
target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable
43+
if (isEditableElement(e.target)) return
4644
47-
if (isEditableTarget) return
48-
49-
if (e.key === '/') {
45+
if (isKeyWithoutModifiers(e, '/')) {
5046
e.preventDefault()
5147
5248
// Try to find and focus search input on current page
@@ -62,7 +58,7 @@ function handleGlobalKeydown(e: KeyboardEvent) {
6258
router.push('/search')
6359
}
6460
65-
if (e.key === '?') {
61+
if (isKeyWithoutModifiers(e, '?')) {
6662
e.preventDefault()
6763
showKbdHints.value = true
6864
}
@@ -72,9 +68,20 @@ function handleGlobalKeyup() {
7268
showKbdHints.value = false
7369
}
7470
71+
/* A hack to get light dismiss to work in safari because it does not support closedby="any" yet */
72+
// https://codepen.io/paramagicdev/pen/gbYompq
73+
// see: https://github.com/npmx-dev/npmx.dev/pull/522#discussion_r2749978022
74+
function handleModalLightDismiss(e: MouseEvent) {
75+
const target = e.target as HTMLElement
76+
if (target.tagName === 'DIALOG' && target.hasAttribute('open')) {
77+
;(target as HTMLDialogElement).close()
78+
}
79+
}
80+
7581
if (import.meta.client) {
7682
useEventListener(document, 'keydown', handleGlobalKeydown)
7783
useEventListener(document, 'keyup', handleGlobalKeyup)
84+
useEventListener(document, 'click', handleModalLightDismiss)
7885
}
7986
</script>
8087

@@ -95,6 +102,29 @@ if (import.meta.client) {
95102
</div>
96103
</template>
97104

105+
<style scoped>
106+
/* Skip link */
107+
.skip-link {
108+
position: fixed;
109+
top: -100%;
110+
inset-inline-start: 0;
111+
padding: 0.5rem 1rem;
112+
background: var(--fg);
113+
color: var(--bg);
114+
font-size: 0.875rem;
115+
z-index: 100;
116+
transition: top 0.2s ease;
117+
}
118+
119+
.skip-link:hover {
120+
color: var(--bg);
121+
text-decoration: underline;
122+
}
123+
.skip-link:focus {
124+
top: 0;
125+
}
126+
</style>
127+
98128
<style>
99129
/* Keyboard shortcut highlight on "?" key press */
100130
kbd {

0 commit comments

Comments
 (0)