block / block/buzz

[Bug] iOS: composer long-press copy/paste menu flickers continuously, menu unusable

Open
#5,226 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

## Summary

On the Buzz iOS app, long-pressing the message composer input field to bring up the copy/paste (edit) menu causes the menu to **flicker continuously** — it hides and immediately reopens in a loop, making it impossible to tap any menu item (Copy / Paste / Select All). The composer becomes effectively unusable for text editing.

## Environment

- Buzz iOS app (Flutter mobile client; `mobile/pubspec.yaml` — Dart SDK `^3.11.4`, `pubspec.lock` pins Flutter `>=3.38.4`)
- iOS 16+ (System Context Menu path)
- Repro: long-press (or tap after long-press) inside the message composer input field; menu flickers every time

## Root cause analysis

The mobile composer passes a custom `contextMenuBuilder` (`mobile/lib/features/channels/compose_bar/compose_bar_widget.dart:914`) that returns `SystemContextMenu.editableText` on iOS (`compose_bar_widget.dart:638-650`). Using the iOS System Context Menu is exactly the configuration that triggers a known, still-unfixed Flutter framework bug where the menu hides and immediately reopens (flicker):

- flutter/flutter [#168743](https://github.com/flutter/flutter/issues/168743) (open): "[iOS] Tapping selection to toggle the toolbar doesn't work when using system context menu" — system and Flutter handle the toggle simultaneously
- flutter/flutter [#169835](https://github.com/flutter/flutter/issues/169835) (closed as duplicate of #168743): "[iOS] TextField context menu flickers (hides and reopens) on subsequent single tap" — symptom matches this report verbatim
- flutter/flutter [#173489](https://github.com/flutter/flutter/issues/173489) (open): triple-tap flicker variant
- Fix PR flutter/flutter [#169720](https://github.com/flutter/flutter/pull/169720) (toggleToolbar debounce) and its API split PR [#174890](https://github.com/flutter/flutter/pull/174890) were both closed without merge — upstream remains unfixed

## Suggested fix directions (app side)

1. Debounce the toolbar toggle (mirror the upstream proposal): ignore a toggle within ~100ms of the previous hide.
2. Or fall back to Flutter's built-in `AdaptiveTextSelectionToolbar.buttonItems` on iOS until the framework fix lands.
3. Note: the composer also injects a custom "Paste Image" item gated on `clipboardHasImage` (`compose_bar_widget.dart:641-654`); it is refreshed only on focus/resume, so it is not the flicker driver, but any future work on this menu should keep that item's state stable while the menu is open.

Contributor guide

Open the contributing guide

Research direction

Start in mobile/lib/features/channels/compose_bar/compose_bar_widget.dart at the contextMenuBuilder around lines 638-654 and its use around line 914. Reproduce on iOS 16+ with a long press, then inspect the existing SystemContextMenu.editableText path and the custom Paste Image item. Done means the composer menu stays open and Copy, Paste, and Select All are usable without losing the item's state.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.