Skip to content

Commit 9e8e19f

Browse files
committed
Merge branch 'main' into refactor-remove-class-shortcuts
2 parents 05fc000 + 5e93353 commit 9e8e19f

113 files changed

Lines changed: 6934 additions & 2006 deletions

File tree

Some content is hidden

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

.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",

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if (import.meta.server) {
4242
function handleGlobalKeydown(e: KeyboardEvent) {
4343
if (isEditableElement(e.target)) return
4444
45-
if (e.key === '/') {
45+
if (isKeyWithoutModifiers(e, '/')) {
4646
e.preventDefault()
4747
4848
// Try to find and focus search input on current page
@@ -58,7 +58,7 @@ function handleGlobalKeydown(e: KeyboardEvent) {
5858
router.push('/search')
5959
}
6060
61-
if (e.key === '?') {
61+
if (isKeyWithoutModifiers(e, '?')) {
6262
e.preventDefault()
6363
showKbdHints.value = true
6464
}
@@ -68,9 +68,20 @@ function handleGlobalKeyup() {
6868
showKbdHints.value = false
6969
}
7070
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+
7181
if (import.meta.client) {
7282
useEventListener(document, 'keydown', handleGlobalKeydown)
7383
useEventListener(document, 'keyup', handleGlobalKeyup)
84+
useEventListener(document, 'click', handleModalLightDismiss)
7485
}
7586
</script>
7687

@@ -91,6 +102,29 @@ if (import.meta.client) {
91102
</div>
92103
</template>
93104

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+
94128
<style>
95129
/* Keyboard shortcut highlight on "?" key press */
96130
kbd {

0 commit comments

Comments
 (0)