@remotion/studio: Fix multiple marquee selection - #9505
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — Allows Cmd/Ctrl+marquee drag to extend the existing timeline selection (keyframes, easings, sequences) instead of replacing it, while preserving Shift+marquee's existing no-op behavior.
- Add
extendTimelineMarqueeSelection— merges a current selection with a marquee-drag selection, filtering incompatible items and deduplicating by selection key. - Wire Cmd/Ctrl+marquee through
useTimelineMarqueeSelection— capturesselectedItemsat pointer-down for use as the extending base, and appliesextendTimelineMarqueeSelectionwhen the marquee was started with a modifier key held. - Preserve selection on Cmd/Ctrl pointer-down —
shouldClearSelectionOnPointerDownnow acceptsctrlKey/metaKeyand returnsfalsewhen either istrue, preventing selection loss before an extending marquee starts. - Add regression tests — unit coverage for extend marquee merging, empty-marquee preservation, duplicate removal, and modifier-key blocking of selection clear.
The implementation is clean: the selectionBeforeMarquee snapshot captures the selection at pointer-down time, the extendSelection flag gates the extend path, and the merge function correctly handles empty marquees, incompatible kinds, and duplicates. The selectedItems dependency addition in useCallback is a standard pattern with negligible cost.
DeepSeek Pro (free via Pullfrog for OSS) (Claude Opus not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since prior review — commit 4c3d07d tightens the shouldClearSelectionOnPointerDown parameter types from optional (ctrlKey?: boolean) to required-nullable (ctrlKey: boolean | null) and switches from truthy modifier-key checks to strict === true comparisons. Tests are updated to pass explicit null values.
- Stricter parameter typing in
shouldClearSelectionOnPointerDown—ctrlKey/metaKeyare now requiredboolean | nullfields, forcing callers to be explicit. The=== truecheck is equivalent to the prior truthy check for boolean inputs and prevents inadvertent truthy matches on non-boolean values. - Test cleanup — all test callsites now pass
ctrlKey: null, metaKey: nullexplicitly, making modifier-key intent visible at each assertion.
The callers (Preview.tsx, EditorContent.tsx) already pass standard DOM PointerEvent objects whose .ctrlKey/.metaKey are always boolean, so the type change requires no caller refactoring and the === true check produces identical runtime behavior.
DeepSeek Pro (free via Pullfrog for OSS) (Claude Opus not used — the program covers this model; add its provider key to run your pick) | 𝕏

Summary
Testing
bun test packages/studio/src/test/clear-selection-on-pointer-down.test.ts packages/studio/src/test/timeline-selection.test.tsbun run buildbun run stylecheckCloses #9379