diff --git a/frontend/src/services/keyboard-shortcut-service.ts b/frontend/src/services/keyboard-shortcut-service.ts index 85d0103..6478d5f 100644 --- a/frontend/src/services/keyboard-shortcut-service.ts +++ b/frontend/src/services/keyboard-shortcut-service.ts @@ -270,7 +270,9 @@ async function dispatch(action: string): Promise { // App actions case 'app.selectAll': - document.execCommand('selectAll'); + document.dispatchEvent( + new CustomEvent('shortcut:select-all'), + ); break; // Panel-specific: track list diff --git a/frontend/src/utils/selection-controller.ts b/frontend/src/utils/selection-controller.ts index 011aecc..42f7f34 100644 --- a/frontend/src/utils/selection-controller.ts +++ b/frontend/src/utils/selection-controller.ts @@ -135,6 +135,24 @@ export class SelectionController implements ReactiveController { this.host.onSelectionChanged?.(); } + /** Select all items. */ + selectAll(): void { + const count = this.host.getItemCount(); + const next = new Set(); + + for (let i = 0; i < count; i++) { + const key = this.host.getItemKey(i); + if (key !== undefined) next.add(key); + } + + if (next.size === this._selectedItems.size) return; + + this._selectedItems = next; + this.lastSelectedIndex = count > 0 ? count - 1 : null; + this.host.requestUpdate(); + this.host.onSelectionChanged?.(); + } + /** * Return the selected keys in the order they appear in the host's * item list. This preserves positional ordering for queue operations.