Skip to content

fix(ios26): let a tap reach the child of the native context menu - #191

Open
itsatifsiddiqui wants to merge 1 commit into
berkaycatak:mainfrom
itsatifsiddiqui:fix/ios26-context-menu-child-taps
Open

itsatifsiddiqui wants to merge 1 commit into
berkaycatak:mainfrom
itsatifsiddiqui:fix/ios26-context-menu-child-taps

Conversation

@itsatifsiddiqui

Copy link
Copy Markdown
Contributor

Description

On iOS 26+ a plain tap on a tappable child of AdaptiveContextMenu (for example a GestureDetector with onTap) never fired. The transparent UiKitView sat above the child in hit testing, so its gesture arena member joined first and won every tap at the arena sweep. Long press and the native menu are unchanged, iOS 18 and Android are unchanged.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement

Related Issues

Follow-up to #161

Changes Made

  • ios26_context_menu.dart: a small Stack subclass still paints the platform view on top, but hit tests the child first and then always the platform view. The child's tap joins the arena first and wins, the platform view is told to drop that touch (the same path as when a scroll wins), and a long press still wins early and opens the native menu with the lifted preview.
  • test/ios26_context_menu_test.dart: a tap reaches the child, a double tap on a parent still wins, and a long press goes to the platform view. The tap test fails without the fix.

Arena log before the fix, tapping a GestureDetector inside the menu on an iOS 26 simulator:

Adding: Instance of '_CombiningGestureArenaMember'
Adding: TapGestureRecognizer(debugOwner: GestureDetector)
...
Sweeping with 2 members.
Winner: Instance of '_CombiningGestureArenaMember'

Testing

Automated Tests ⚠️ REQUIRED

  • I have added unit/widget tests for my changes
  • All new and existing tests pass locally (flutter test)
  • Code analysis passes with no errors (flutter analyze)
  • Code formatting is correct (dart format)
  • Test coverage is adequate (>80% for new code)

Manual Testing

  • iOS 26+ tested (simulator): tapping a photo inside a chat bubble wrapped in AdaptiveContextMenu opens it, long press opens the native menu, double tap and scrolling still work
  • iOS <26 tested (code path unchanged)
  • Android tested (code path unchanged)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Breaking Changes

None

The transparent platform view sat above the child in hit testing, so its
arena member joined first and won every plain tap at the sweep. Hit test
the child first while still painting the platform view on top, so a tap
goes to the child and a long press still opens the native menu.
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.

1 participant