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

+3 -7
View File
@@ -4622,13 +4622,9 @@ Object.assign(CodemanApp.prototype, {
const on = this._filePreviewPref('expanded');
const win = this.$('filePreviewOverlay')?.querySelector?.('.file-preview-window');
win?.classList?.toggle('expanded', on);
const btn = this.$('filePreviewExpandBtn');
if (btn) {
btn.setAttribute('aria-pressed', on ? 'true' : 'false');
const label = on ? 'Restore size' : 'Expand';
btn.title = label;
btn.setAttribute('aria-label', label);
}
// The label stays "Expand" and aria-pressed carries the state, like MD, Lines and
// Wrap, so a screen reader never announces "Restore size, pressed".
this.$('filePreviewExpandBtn')?.setAttribute('aria-pressed', on ? 'true' : 'false');
},
/**