Repository navigation
fix(input): share right-click menus across the input frame - #4
Merged
Merged
Conversation
Reuse the existing Base pending request for editor and styled padding, preserving selections and descendant-owned gestures. Recheck current handler, policy, capabilities and focus before deferred delivery, then release the entity borrow before application menu builders run. Cancel stale requests on Escape, policy changes, blur, outside gestures and deactivation. Validation: exact-path rustfmt and diff checks pass; Kit input integration target 166 passed, 0 failed, 0 ignored; Base context-menu tests 2 passed, 0 failed, 1245 filtered. Actual GPUI pointer dispatch covers selection, cancellation, focus ownership, release-time policy changes, masked/read-only clipboard protection and custom builders reading their input. Native OS popup presentation and Linux-only drawn-menu regression await hosted/platform acceptance.
There was a problem hiding this comment.
🟡 Changes recommended
Nested context menus can conflict with the frame handler, and the new public APIs are undocumented.
2 open findings
What changed in this PR
Extends shared input context-menu handling to styled frame padding while preserving selection and revalidating state before delivery.
Changes:
- Adds shared request, completion, and cancellation lifecycle.
- Routes frame and editor right-click gestures through that lifecycle.
- Adds regression coverage for selection, cancellation, policy, and clipboard behavior.
| File | Description |
|---|---|
crates/base/src/input/base/state.rs |
Implements shared context-menu lifecycle and policy checks. |
crates/component/src/input/input.rs |
Handles right-clicks across the styled input frame. |
crates/component/src/input/state.rs |
Forwards frame events to Base state. |
crates/kit/tests/input.rs |
Registers the new test module. |
crates/kit/tests/input/context_menu.rs |
Adds end-to-end context-menu regressions. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Comment on lines
+782
to
+784
| // A descendant owns a prevented press. The editor has already | ||
| // queued its own hit request; decorations preserve selection. | ||
| if !window.default_prevented() && state.request_context_menu(event.position, cx) |
| /// on release or [`Self::cancel_context_menu`] if the gesture is cancelled. | ||
| /// The editor and its decorations share one pending request. Disabled inputs, | ||
| /// disabled menus and deferred contexts refuse the request. | ||
| pub fn request_context_menu( |
Comment on lines
+2135
to
+2139
| pub fn request_context_menu( | ||
| &mut self, | ||
| position: Point<Pixels>, | ||
| cx: &mut Context<Self>, | ||
| ) -> bool { |
There was a problem hiding this comment.
Use the existing ObservedElement alias when inspecting the styled dropdown trigger. Hosted test-support wraps the native Stateful Div; downcasting it as a bare Div panicked before exercising accessibility. Preserve label, Click, expanded and disabled assertions, with no production behavior change. Validation: focused test-support accessibility regression 1 passed, 0 failed, 586 filtered; exact-file rustfmt and diff checks passed. Earlier Linux CI job113314166234 retained: Base1248 passed, Component616 passed/1 failed. Input implementation unchanged from ba627 (166 input +2 Base checks passed). Root reviewed the delegated source change; hosted qualification pending. APPS-256.
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.


Styled Input padding and border now use the incumbent InputBase context-menu request, preserving selection and delivering exactly one menu callback. Inner-text positioning and frame gestures share the same pending request, with cancellation on Escape, blur, deactivation, disabled/opt-out policy and outside gestures. Deferred callbacks read the current policy and run outside the mutable entity borrow, so custom menu builders can safely inspect their input.
The changes retain existing drag cleanup and default focus behavior. Pointer regressions cover forward/reversed selections, frame/text crossings, stale presses, descendant policy changes and clipboard restrictions. The dropdown accessibility fixture now inspects the existing feature-aware element alias so test-support observes the same native semantics; label, activation, expanded and disabled assertions are unchanged.
Validation:
No native OS popup-presentation, App dependency adoption, deployment or customer readiness is claimed by these tests. APPS-256. Root reviewed all delegated changes.