fix(file-viewer): keep the Expand label fixed while it is pressed

Merge-time fix for #659.

The Expand button swapped its title and aria-label to "Restore size"
while on, so a screen reader announced "Restore size, pressed". The
label now stays "Expand" and aria-pressed alone carries the state, the
way the MD, Lines and Wrap toggles work.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-22 19:17:05 +02:00
1 parent e3c6f9f2c7
commit df521267ae
2 files changed
+10 -8

No files matched your search

+7 -1
View File
@@ -196,16 +196,22 @@ describe('file viewer back/forward', () => {
describe('file viewer expand', () => {
it('toggles the window class, the pref and the button state', () => {
const { app, winClasses, store, expand } = loadApp();
// As index.html ships it.
expand.title = 'Expand';
expand.attrs['aria-label'] = 'Expand';
app.toggleFilePreviewExpanded();
expect(winClasses.has('expanded')).toBe(true);
expect(store['codeman:filePreviewExpanded']).toBe('1');
expect(expand.attrs['aria-pressed']).toBe('true');
expect(expand.title).toBe('Restore size');
// aria-pressed carries the state; the label stays fixed, like the MD/Lines/Wrap toggles.
expect(expand.title).toBe('Expand');
expect(expand.attrs['aria-label']).toBe('Expand');
app.toggleFilePreviewExpanded();
expect(winClasses.has('expanded')).toBe(false);
expect(expand.attrs['aria-pressed']).toBe('false');
expect(expand.title).toBe('Expand');
});
it('re-applies a remembered expanded state when a preview opens', async () => {