Repository navigation
Conversation
Right clicking keeps a selection under the pointer. Elsewhere, macOS and iOS select the word under the pointer and other platforms clear the selection. The default menu shows Copy only when text is selected, Copy link over a link, Select all, and Copy all; Clear selection is gone. It closes on Escape, scrolling, and any click. MarkdownWidget and MixinSelectionArea share this logic in MarkdownSelectionHost. BREAKING CHANGE: MarkdownContextMenuBuilder is now (BuildContext, MarkdownContextMenuDetails). The details carry the anchors, the default button items, the selection controller, the link under the pointer, and hide(). contextMenuBuilder defaults to defaultMarkdownContextMenuBuilder; pass null to show no menu. MarkdownContextMenu is removed, and showCopyAllInContextMenu is deprecated in favor of filtering details.buttonItems.
boyan01
added this pull request to stack #545
October 21, 2026 01:38
boyan01
marked this pull request as ready for review
October 21, 2026 01:49
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.
Summary
Stacked on #550. The right-click menu ignored where you clicked, always showed the same items, and stayed open on scroll and Escape. The menu now lives in
MarkdownSelectionHost, soMarkdownWidgetandMixinSelectionAreabehave the same.Breaking API:
flutter-app's
contextMenuBuilder: (_, _, _, _) => SizedBox.shrink()becomescontextMenuBuilder: null. Version and CHANGELOG are left for the release (0.4.0).Evidence
Before: the new
markdown_context_menu_test.dart(the 6 behavior tests) against the oldlib/, 5 failed:After: 13/13, including the new API: Copy writes the selection, Copy link writes the destination for a plain link, an emphasized link, and a link in a table cell, no Copy link on plain text, a null builder shows nothing and keeps the selection, a custom builder receives the details and closes the menu with
details.hide.Package
flutter teston macOS: 280 passed.flutter analyze(package and example): no issues. Checked by hand in the macOS example: right click word selection (incl. Chinese), Copy link on plain / emphasized / table links, closing on Escape, scroll, click, and button press, and the custom item. Windows and Linux not checked in the GUI.Merge Danger
Door: two-way
Blast Radius: consumers
Callers that pass a 4-argument
contextMenuBuilderor useMarkdownContextMenustop compiling. Callers that passcontextMenuBuilder: nullto get the default menu now get no menu. Right click on Windows/Linux outside the selection now clears it.