Skip to content

Desktop: Make input routing aware of floating menus - #4498

Merged
timon-schelling merged 3 commits into
desktop-restructure-ui-inputfrom
desktop-fix-pointer-input-routing
Sep 6, 2026
Merged

Desktop: Make input routing aware of floating menus#4498
timon-schelling merged 3 commits into
desktop-restructure-ui-inputfrom
desktop-fix-pointer-input-routing

Conversation

@timon-schelling

Copy link
Copy Markdown
Member

No description provided.

@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from 152cb54 to f033e5f Compare September 2, 2026 19:53

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/managers/floating-menus.ts Outdated
Comment thread frontend/src/managers/input.ts Outdated
Comment thread desktop/src/input.rs Outdated
@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from f033e5f to 17e6ba1 Compare September 2, 2026 21:01
@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from 17e6ba1 to 0001d63 Compare September 2, 2026 21:20
@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from 0001d63 to 122b28d Compare September 4, 2026 02:15
@timon-schelling
timon-schelling changed the base branch from master to desktop-restructure-ui-input September 4, 2026 02:16
@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from 122b28d to ee509aa Compare September 4, 2026 02:17
@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from ee509aa to 08c89a9 Compare September 4, 2026 02:51

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 11 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/managers/input.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 7 files (changes from recent commits).

Confidence score: 3/5

  • In frontend/src/components/panels/Document.svelte, removing the reportFloatingMenuClose(textboxId) cleanup can leave textToolInteractiveInputElement permanently set when the Document panel is destroyed, affecting later text-input behavior — restore equivalent cleanup on destruction.
  • In frontend/src/components/layout/FloatingMenu.svelte, the destruction callback can re-enable native direct input after destroyInputManager() has disabled it, leaving editor input in an inconsistent state — guard menu-state updates during manager teardown.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/src/components/panels/Document.svelte">

<violation number="1">
P2: Removing the `reportFloatingMenuClose(textboxId)` call from `onDestroy` leaves `textToolInteractiveInputElement` in `src/utility-functions/input.ts` permanently set when the Document panel is destroyed while its text box is open. That module-level state is only cleared by the `modifyinputfield` event that `displayRemoveEditableTextbox()` dispatches; there is no destroy-time path anymore. By contrast the removed code cleaned up on destroy. Result: `updateDirectInput` keeps `directInputEnabled = false` (desktop direct input stays off) and `onPointerUp`/`onPointerDown` keep treating clicks as text commits for any subsequently opened document. Dispatch `modifyinputfield` with `undefined` (or clear `textToolInteractiveInputElement`) in Document.svelte's `onDestroy`.</violation>
</file>

<file name="frontend/src/components/layout/FloatingMenu.svelte">

<violation number="1" location="frontend/src/components/layout/FloatingMenu.svelte:167">
P2: When the editor is torn down with a floating menu mounted, this `onDestroy` callback can re-enable native direct input after `destroyInputManager()` has disabled it. Guard menu-state updates during manager teardown or perform the final disable after all child components are destroyed.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

});

onDestroy(() => {
onFloatingMenuOpenChange(menuId, false, editor);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: When the editor is torn down with a floating menu mounted, this onDestroy callback can re-enable native direct input after destroyInputManager() has disabled it. Guard menu-state updates during manager teardown or perform the final disable after all child components are destroyed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/layout/FloatingMenu.svelte, line 167:

<comment>When the editor is torn down with a floating menu mounted, this `onDestroy` callback can re-enable native direct input after `destroyInputManager()` has disabled it. Guard menu-state updates during manager teardown or perform the final disable after all child components are destroyed.</comment>

<file context>
@@ -163,7 +164,7 @@
 
 	onDestroy(() => {
-		reportFloatingMenuClose(menuId);
+		onFloatingMenuOpenChange(menuId, false, editor);
 		containerResizeObserver.disconnect();
 		dialogResizeObserver?.disconnect();
</file context>

Comment thread desktop/src/input.rs

#[derive(Clone, Copy, PartialEq)]
enum Route {
Ui,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: UI would look a bit nicer.

@timon-schelling
timon-schelling force-pushed the desktop-fix-pointer-input-routing branch from 8818ec2 to 5cfc0bf Compare September 6, 2026 01:14
@timon-schelling
timon-schelling added this pull request to the merge queue Sep 6, 2026
Merged via the queue into master with commit 63725ea Sep 6, 2026
10 checks passed
@timon-schelling
timon-schelling deleted the desktop-fix-pointer-input-routing branch September 6, 2026 01:49
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