@remotion/studio: Clear stale hover backgrounds - #10068
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
hoverable.ts— New shared module with CSS class names, ahoverableStyle()helper that emits four CSS custom properties (idle/hover × background/color) via inline style, and an injected stylesheet with@media (hover: hover)gating, doubled-class-name specificity to beat.css-reset *, and*descendant selectors forcurrentColorinheritance.InlineAction— DropsuseState(false)hover and theonPointerEnter/onPointerLeavehandlers; spreadshoverableStyleinto the inline style and passesCURRENT_COLORtorenderActioninstead ofWHITE/LIGHT_TEXT.InspectorInlineAction— Same migration for the single and segmented variants; the segmented trailing icon reveal switches from a ternary renderinghiddenSegmentedTrailingIcon(opacity 0) to CSS group-hover rules withHOVER_GROUP_REVEAL_CLASS_NAME.MenuItem— Background and color styling moved tohoverableStyle;onPointerEnterkept solely for the submenu-switch-while-open logic,onPointerLeaveandsetHoveredremoved.inject-css.ts— WiresmakeHoverableCSS()into the global injected stylesheet.- Browser Studio Playwright test — Hovers "Add Solid" and a menubar item, suppresses
pointerleave/mouseleaveevents at window capture (simulating the iframe boundary bug), moves the pointer away, and asserts backgrounds reset torgba(0,0,0,0).
DeepSeek Pro (free via Pullfrog for OSS) (Claude Opus not used — the program covers this model; add its provider key to run your pick) | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #9886
Problem
Hover backgrounds of Studio controls were driven by React state (
pointerenter→setHovered(true),pointerleave→setHovered(false)) and rendered as inline styles. When Studio runs inside an<iframe>(as in Browser Studio), browsers can fail to deliverpointerleavewhen the pointer exits the frame. A single missed event left the hover background stuck indefinitely, e.g. on Add Solid and menubar items.Fix
Purely visual hover styling is now driven by CSS
:hover, which the browser maintains itself and self-corrects even when boundary events are dropped. Because each control has different idle/hover/selected colors, a shared injected stylesheet reads them from inherited CSS custom properties that components set inline:packages/studio/src/helpers/hoverable.ts: class names, ahoverableStyle()helper emitting the four CSS variables (idle/hover × background/color), and the injected CSS. The rules use doubled class names to win over the.css-reset *rule regardless of stylesheet injection order, and*descendant selectors re-establish color inheritance inside hoverable elements so text andcurrentColor-based icons follow the hover state. Hover rules are gated behind@media (hover: hover)to avoid sticky tap-hover on touch devices.InlineAction(used by the render queue, sidebar toggles, undo/redo, asset rows etc.),InspectorInlineAction(Add Solid, including the segmented variant with its reveal-on-hover trailing icon) and the menubarMenuItem. Icons receivecurrentColorinstead of a resolved color string.selected(open menu) still drives the menubar highlight, andMenuItem'spointerenterhandler is kept solely for the switch-menu-while-open logic.Components where hover state drives logic (revealing row action buttons, submenu open delay, timeline/canvas hover sync) are unchanged and can migrate to this mechanism incrementally.
Test
Added a Playwright regression test to the Browser Studio e2e suite that hovers Add Solid, then suppresses all pointer/mouse leave events at window capture (simulating the lost events at the iframe boundary), moves the pointer away and asserts the background resets; same for a menubar item. The test fails against the previous implementation (background stays stuck at
rgba(255, 255, 255, 0.06)) and passes with this fix.Also verified in the regular Studio (
packages/example) that idle, hovered, selected and open-menu states as well as hover-switching between open menus are visually unchanged.