Skip to content

fix(studio): colour compare holds and beat drags survive a sealed preview taking the keyboard - #9108

Merged
miguel-heygen merged 3 commits into
mainfrom
fix/blur-cancels-frame-focus
Nov 30, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
fix/blur-cancels-frame-focus

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

A hold-to-compare in the colour grading panel and a beat drag on the timeline are no longer released when a sealed preview takes the keyboard mid-gesture. #9107 fixed the same thing for a drag on the canvas. This moves its check into one shared helper and has every gesture that ends on a window blur ask it first.

  • Gate: unchanged at 40 behaviours, all with a test.

Why

A sealed preview's frame takes keyboard focus after a save, which blurs Studio's window although the person never left the page. Every gesture that ended on a window blur read that as the person leaving. In #9107 that dropped a canvas drag; the same focus move landing during a held compare button or a beat drag released those too. Sealed must behave as unsealed, where the preview never takes focus.

Related work

Stacked on #9107; review that first.

How

  • utils/focusMovedIntoAFrame.ts: focusMovedIntoAFrameOnThePage, moved out of useHeldGestureCancel.ts. It follows the focused element through open shadow roots, since the preview's frame sits inside the player's.
  • useHeldGestureCancel.ts, propertyPanelColorGradingSection.tsx, propertyPanelFlatColorGradingAccessory.tsx and BeatStrip.tsx each release on a window blur only when that returns false. Their other releases (pointer up, pointer cancel, Escape, a hidden tab) are unchanged.
  • Not changed: the timeline's Shift tracking (useTimelineShiftModifier.ts) resets on a window blur, which stays right when focus moves into the frame: the frame then gets the key up.
  • The compare buttons' own onBlur is left alone. A pointer hold never focuses the button, and a held Space must end when focus leaves, since its key up goes elsewhere.

Test plan

  • fails without the fix: "keeps a drag when focus moves into a frame on the page" (packages/studio/src/player/components/BeatStrip.test.tsx), "keeps a hold when focus moves into a frame on the page" (packages/studio/src/components/editor/propertyPanelFlatColorGradingSection.test.tsx) and "keeps a hold when focus moves into a frame on the page, and ends it when the window goes" (packages/studio/src/components/editor/propertyPanelColorGradingSection.test.tsx), with fix(studio): a drag pressed as a sealed preview takes the keyboard is no longer dropped #9107's canvas test. With the helper forced to the old answer, all four fail. With it forced to the opposite answer, "cancels without mutation when the window loses focus" (new, BeatStrip.test.tsx), "releases an active hold when the window loses focus mid-hold" and the canvas blur tests fail, so a real window blur still cancels.

  • BeatStrip, both colour grading tests, gestureHoldsPreviewReload, useSealedCanvasKeys.sealed, DomEditOverlay, editorGesturesExports, shiftDragAxisLock, selectionHandlesRideTheBox, sealedRawDragStep, PropertyPanel and Timeline.readOnly tests: 240 of 240, 3 runs in a row. tsc --noEmit in packages/studio: exit 0.

  • Not run: a bench case for these two gestures; the edit accuracy bench has none.

  • Unit tests added/updated

  • Manual testing performed

  • Documentation updated (if applicable)

  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

No visible change

The sealed preview is not on by default. In a sealed preview, a compare hold or a beat drag now lasts until it is let go, as it does unsealed.

… no longer dropped

The sealed frame taking keyboard focus blurs Studio's window, and the held
gesture cancel read that as the person leaving the window. A blur whose
focus went into a frame on the page now leaves the press held.
…view taking the keyboard

A focus move into a frame on the page blurs the window though the person
never left it. The held-gesture cancel, both hold-to-compare buttons and the
beat drag now ask one shared helper before releasing on a window blur.
Base automatically changed from fix/held-press-frame-focus to main November 29, 2026 20:18
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 275 (base branch 273), smooth 44 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-root-z100
  • seqscaletwice-scale-px-r0-nested-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-root-z100
  • seqscaletwice-scale-px-r0-nested-z100

Quarantined, measured but not gated (0)

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 269375a. The change itself is right; it needs a rebase onto main before it can merge.

Requesting changes: merged with today's main, useHeldGestureCancel.ts declares focusMovedIntoAFrameOnThePage twice. #9107 landed on main as a squash, with the helper as a local function in that file. This branch still carries #9107's original commit and then moves the helper to utils/focusMovedIntoAFrame.ts. Git merges the two without a conflict, so GitHub shows the PR as mergeable, but the result keeps both. I built the merge tree of main and this head (git merge-tree); the file starts:

import { focusMovedIntoAFrameOnThePage } from "../../utils/focusMovedIntoAFrame";

function focusMovedIntoAFrameOnThePage(): boolean {

That is an import clashing with a local declaration, so Studio's type check fails on the merged result. Rebase onto main (dropping the #9107 commit) so the local function is removed in this diff, and I approve.

"Studio and player captures" is also red at this head; please check it on the rebased head.

The rest, read in full as changed (source files; tests by name and by the body's list):

  • The helper is the one from #9107, unchanged, now shared.
  • All four blur releases (useHeldGestureCancel, both colour compare buttons, BeatStrip) ask it first, and each removes the same listener it added (releaseOnBlur / cancelBeatDragOnBlur), so nothing is left attached.
  • Pointer up, pointer cancel, Escape, hidden tab and the buttons' own onBlur still release.
  • fails without the fix: is in the body and names its tests.

Not run: tests or type checks (no installed packages on this box); the merge tree above is the one thing I built.

Need: yes · Size: small · Reuse: one helper for four gestures · Simpler: no · Structure: sound
Risk: low once rebased.

— Rames

Main has #9107 as a squash with the helper local to useHeldGestureCancel.ts;
this branch moves it to utils/focusMovedIntoAFrame.ts, so the merge drops the
local copy that would otherwise sit beside the import.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Thanks, confirmed: merged with main, useHeldGestureCancel.ts both imported and declared the helper.

Fixed in 2a0b77c, a merge of main rather than a rebase, so the commits already pushed stay as they are. The merge removes the local copy #9107 left in useHeldGestureCancel.ts, so the file now only imports the shared helper. Against main the diff is this PR's 8 files and nothing else.

At 2a0b77c: tsc --noEmit in packages/studio exits 0. The four test files this PR touches (gestureHoldsPreviewReload, both colour grading sections, BeatStrip) pass 89 of 89, 3 runs in a row.

"Studio and player captures" fails because the diff touches .tsx files, so "No visible change" does not count. Before and After captures of a held compare button in a sealed preview will follow in a comment.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 2a0b77c (re-review of my change request at 269375a).

Prior point, resolved. useHeldGestureCancel.ts now only imports focusMovedIntoAFrameOnThePage from utils/focusMovedIntoAFrame.ts; the local declaration is gone and the helper has one definition, used by the four callers. A trial merge with current main is clean.

Still holding on one thing: the "Studio and player captures" check is red at this head, and it is caused by this PR. The diff touches .tsx files, so the check wants a ## Before and a ## After section, each with an image or video, in the description or in one comment by the author. The current comment has neither heading. No code change is needed; I will approve once that check is green.

What I checked: the PR's own change against main is the same 8 files as before (150 added, 12 removed); compared with the head I reviewed, the only differences are the helper declaration removed here and the lines main already carries. Read useHeldGestureCancel.ts and focusMovedIntoAFrame.ts whole at this head; the other six files as hunks, unchanged from my earlier read. I did not run the tests (no dependencies installed on my machine); the other checks were still pending when I looked.

Need: yes · Size: fine · Reuse: yes, one shared helper · Simpler: no · Structure: good
Risk: low.

— Rames

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Captures for the red "Studio and player captures" check, at 2a0b77c. Sealed preview, a repo-style fixture with one image graded with the VHS preset. "Hold to show original" is held down throughout. Then focus moves into the preview frame, as it does when the sealed preview takes the keyboard after a save. Each shot is taken after that focus move, with the button still held.

Before

main at 90522c4: the window's blur released the held compare, so the graded image is back while the button is still down.

Before: the VHS grade shows again while the compare button is still held

After

This PR: the hold survives the focus move, and the original image stays until the button is let go.

After: the original image still shows while the compare button is held

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Thanks. The captures are in the comment above, with a ## Before and an ## After section, each with an image. "Studio and player captures" now passes at 2a0b77c (run 46321797857), and no check is failing at this head. No code changed since your review, so the head is still 2a0b77c.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 2a0b77c. Same head as my earlier review, so no code changed. The only thing I held on was the "Studio and player captures" check, which this PR turned red; it is green now and the Before/After captures are posted. 61 checks pass, none fail. Nothing re-run locally. My earlier read of the code stands.

Need: yes · Size: unchanged · Reuse: unchanged · Simpler: no · Structure: unchanged
Risk: none new since the last review.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit f48dff5 Nov 30, 2026
89 of 91 checks passed
@miguel-heygen
miguel-heygen deleted the fix/blur-cancels-frame-focus branch November 30, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants