Skip to content

fix(input): share right-click menus across the input frame - #4

Merged
Hmbown merged 2 commits into
codewhale/v0.7.0from
fix/input-frame-context-menu-20261008
Oct 8, 2026
Merged

Hmbown merged 2 commits into
codewhale/v0.7.0from
fix/input-frame-context-menu-20261008

Conversation

@Hmbown

@Hmbown Hmbown commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • Exact implementation:166 Input integration tests and2 Base context-menu tests passed locally.
  • Focused dropdown accessibility regression with test-support:1 passed,0 failed,586 filtered; exact-file formatting passed.
  • Earlier real failures are retained: the first callback implementation caused4 reentrant-entity panics, fixed before ba627. Hosted Linux on ba627 passed1248 Base tests and616 Component tests but failed the incumbent dropdown fixture; e37fa2a fixes that fixture and is awaiting its own hosted checks.

No native OS popup-presentation, App dependency adoption, deployment or customer readiness is claimed by these tests. APPS-256. Root reviewed all delegated changes.

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.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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(

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +2135 to +2139
pub fn request_context_menu(
&mut self,
position: Point<Pixels>,
cx: &mut Context<Self>,
) -> bool {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Document the new public menu APIs

The description omits the required ## Public API section for three new Base methods. List their signatures and purposes by crate so reviewers can assess the public contract.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.
@Hmbown
Hmbown merged commit d7ce6d9 into codewhale/v0.7.0 Oct 8, 2026
12 checks passed
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