Proposal Direction – Secure Paste Custom Actions on iOS

41 views
Skip to first unread message

Divyansh Shah

unread,
Mar 2, 2026, 5:31:06 AM (8 days ago) Mar 2
to dart-gsoc

Hi all,

I’m Divyansh, and I’ve been actively contributing to Flutter. One of my PRs was recently merged into the Flutter repository:

https://github.com/flutter/flutter/pull/182051

I also have another PR currently under review(Expose computeLineMetrics on RenderParagraph by crackedhandle · Pull Request #181240 · flutter/flutter). Working through these contributions has helped me understand the framework–engine workflow, platform channel integration patterns, and the expectations around core code reviews.

I’ve been exploring the “Secure Paste Custom Actions on iOS” idea and wanted to share my current direction for feedback.

As part of preparation, I have:

  • Built a Flutter demo using contextMenuBuilder to experiment with ContextMenuButtonItem customization.

  • Built a minimal UIKit (Objective-C) demo using UIEditMenuInteraction to understand native UIAction injection into the iOS edit menu.

After reviewing:

  • The context menu breaking change documentation

  • PR #161103 (framework-driven menu configuration groundwork)

  • Apple’s UIEditMenuInteraction API

It appears that the remaining milestone is building a structured bridge between Dart-defined ContextMenuButtonItem objects and native UIAction instances in the iOS engine.

Proposed direction:

Framework (Dart):

  • Keep contextMenuBuilder as the single source of truth.

  • Extend the existing menu configuration message to include:

    • identifier

    • label

    • enabled/destructive state

    • optional icon metadata.

Engine (iOS, Objective-C):

  • Deserialize custom items.

  • Convert them into UIAction objects.

  • Inject them via UIEditMenuInteraction.

  • Maintain an identifier-to-callback mapping.

  • Dispatch selection events back to Dart through the existing text input channel (or a scoped extension).

Compatibility:

  • iOS 16 and above: use UIEditMenuInteraction.

  • iOS below 16: gracefully fall back to current behavior.

Before drafting a more detailed design proposal, I would appreciate clarification on one architectural point:

Should milestone 2 directly translate ContextMenuButtonItem into native menu elements, or is the intention to introduce a separate Dart-level API specifically for native iOS edit menu customization?

@huanlin @jmcandless — I would value your guidance to ensure this direction aligns with the intended scope before proceeding to a prototype.

Thanks,
Divyansh

Justin McCandless

unread,
Mar 3, 2026, 12:32:05 PM (7 days ago) Mar 3
to dart-gsoc
Hey Divyansh,

Unfortunately this project was already completed last summer. Can I ask where you found it so I can take it down and make sure it's not misleading anyone else? I'll let you know if we post any other Flutter projects.


Justin

Reply all
Reply to author
Forward
0 new messages