Skip to content

Commit 8b8a0dd

Browse files
committed
fix: don't nest select in a summary
1 parent edac571 commit 8b8a0dd

File tree

5 files changed

+36
-46
lines changed

5 files changed

+36
-46
lines changed

app/components/diff/SidebarPanel.vue

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -180,32 +180,32 @@ function handleFileSelect(file: FileChange) {
180180
<span class="i-carbon-document w-3.5 h-3.5" />
181181
{{ $t('compare.file_changes') }}
182182
</span>
183-
<span class="flex items-center gap-2">
184-
<select
185-
v-model="fileFilter"
186-
class="text-[10px] px-2 py-1 bg-bg-subtle border border-border rounded font-mono cursor-pointer hover:border-border-hover transition-colors"
187-
>
188-
<option value="all">
189-
{{ $t('compare.file_filter_option.all', { count: allChanges.length }) }}
190-
</option>
191-
<option value="added">
192-
{{ $t('compare.file_filter_option.added', { count: compare.stats.filesAdded }) }}
193-
</option>
194-
<option value="removed">
195-
{{ $t('compare.file_filter_option.removed', { count: compare.stats.filesRemoved }) }}
196-
</option>
197-
<option value="modified">
198-
{{
199-
$t('compare.file_filter_option.modified', { count: compare.stats.filesModified })
200-
}}
201-
</option>
202-
</select>
203-
<span
204-
class="i-carbon-chevron-right w-3.5 h-3.5 transition-transform group-open:rotate-90"
205-
/>
206-
</span>
183+
<span
184+
class="i-carbon-chevron-right w-3.5 h-3.5 transition-transform group-open:rotate-90"
185+
/>
207186
</summary>
208187

188+
<div class="border-b border-border px-3 py-2 shrink-0 flex items-center justify-end">
189+
<select
190+
v-model="fileFilter"
191+
:aria-label="$t('compare.filter_files_label')"
192+
class="text-[10px] px-2 py-1 bg-bg-subtle border border-border rounded font-mono cursor-pointer hover:border-border-hover transition-colors"
193+
>
194+
<option value="all">
195+
{{ $t('compare.file_filter_option.all', { count: allChanges.length }) }}
196+
</option>
197+
<option value="added">
198+
{{ $t('compare.file_filter_option.added', { count: compare.stats.filesAdded }) }}
199+
</option>
200+
<option value="removed">
201+
{{ $t('compare.file_filter_option.removed', { count: compare.stats.filesRemoved }) }}
202+
</option>
203+
<option value="modified">
204+
{{ $t('compare.file_filter_option.modified', { count: compare.stats.filesModified }) }}
205+
</option>
206+
</select>
207+
</div>
208+
209209
<div class="flex-1 overflow-y-auto min-h-0">
210210
<div v-if="filteredChanges.length === 0" class="p-8 text-center text-xs text-fg-muted">
211211
{{

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@
975975
},
976976
"files_button": "Files",
977977
"select_file_prompt": "Select a file from the sidebar to view its diff",
978-
"close_files_panel": "Close files panel"
978+
"close_files_panel": "Close files panel",
979+
"filter_files_label": "Filter files by change type"
979980
}
980981
}

lunaria/files/en-GB.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@
975975
},
976976
"files_button": "Files",
977977
"select_file_prompt": "Select a file from the sidebar to view its diff",
978-
"close_files_panel": "Close files panel"
978+
"close_files_panel": "Close files panel",
979+
"filter_files_label": "Filter files by change type"
979980
}
980981
}

lunaria/files/en-US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@
975975
},
976976
"files_button": "Files",
977977
"select_file_prompt": "Select a file from the sidebar to view its diff",
978-
"close_files_panel": "Close files panel"
978+
"close_files_panel": "Close files panel",
979+
"filter_files_label": "Filter files by change type"
979980
}
980981
}

test/nuxt/a11y.spec.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,13 +2442,6 @@ describe('component accessibility audits', () => {
24422442
],
24432443
])
24442444

2445-
// DiffSidebarPanel has a known a11y issue: <select> nested inside <summary>
2446-
// This causes 'nested-interactive' violation. TODO: Fix the component to move
2447-
// the select outside of summary or use a different UI pattern.
2448-
function filterKnownViolations(results: AxeResults) {
2449-
return results.violations.filter(v => v.id !== 'nested-interactive')
2450-
}
2451-
24522445
it('should have no accessibility violations', async () => {
24532446
const component = await mountSuspended(DiffSidebarPanel, {
24542447
props: {
@@ -2458,7 +2451,7 @@ describe('component accessibility audits', () => {
24582451
},
24592452
})
24602453
const results = await runAxe(component)
2461-
expect(filterKnownViolations(results)).toEqual([])
2454+
expect(results.violations).toEqual([])
24622455
})
24632456

24642457
it('should have no accessibility violations with selected file', async () => {
@@ -2471,7 +2464,7 @@ describe('component accessibility audits', () => {
24712464
},
24722465
})
24732466
const results = await runAxe(component)
2474-
expect(filterKnownViolations(results)).toEqual([])
2467+
expect(results.violations).toEqual([])
24752468
})
24762469

24772470
it('should have no accessibility violations with file filter', async () => {
@@ -2484,7 +2477,7 @@ describe('component accessibility audits', () => {
24842477
},
24852478
})
24862479
const results = await runAxe(component)
2487-
expect(filterKnownViolations(results)).toEqual([])
2480+
expect(results.violations).toEqual([])
24882481
})
24892482

24902483
it('should have no accessibility violations with warnings', async () => {
@@ -2500,7 +2493,7 @@ describe('component accessibility audits', () => {
25002493
},
25012494
})
25022495
const results = await runAxe(component)
2503-
expect(filterKnownViolations(results)).toEqual([])
2496+
expect(results.violations).toEqual([])
25042497
})
25052498

25062499
it('should have no accessibility violations with no dependency changes', async () => {
@@ -2516,7 +2509,7 @@ describe('component accessibility audits', () => {
25162509
},
25172510
})
25182511
const results = await runAxe(component)
2519-
expect(filterKnownViolations(results)).toEqual([])
2512+
expect(results.violations).toEqual([])
25202513
})
25212514
})
25222515

@@ -2547,12 +2540,6 @@ describe('component accessibility audits', () => {
25472540
{ path: 'changed.ts', type: 'modified' as const, oldSize: 200, newSize: 250 },
25482541
]
25492542

2550-
// DiffMobileSidebarDrawer uses DiffSidebarPanel which has a known a11y issue:
2551-
// <select> nested inside <summary>. See DiffSidebarPanel tests for details.
2552-
function filterKnownViolations(results: AxeResults) {
2553-
return results.violations.filter(v => v.id !== 'nested-interactive')
2554-
}
2555-
25562543
it('should have no accessibility violations when closed', async () => {
25572544
const component = await mountSuspended(DiffMobileSidebarDrawer, {
25582545
props: {
@@ -2576,7 +2563,7 @@ describe('component accessibility audits', () => {
25762563
},
25772564
})
25782565
const results = await runAxe(component)
2579-
expect(filterKnownViolations(results)).toEqual([])
2566+
expect(results.violations).toEqual([])
25802567
})
25812568
})
25822569

0 commit comments

Comments
 (0)