Skip to content

🐛 FluentTextSelectionToolbar ignores any ContextMenuButtonItem that has a type different than a pre-defined set #1317

@Dancovich

Description

@Dancovich

When building a FluentTextSelectionToolbar to return to the contextMenuBuilder argument of a SelectableRegion, the list of ContextMenuButtonItem passed to buttonItems must not contain any type other than either cut, copy, paste, selectAll or custom.

If you use types like lookUp or searchWeb, the option will just not appear in the context menu.

To Reproduce

  1. Create a new Flutter project using the fluent_ui package
  2. Create a SelectableRegion around one or more Text widgets
  3. Pass a function to the contextMenuBuilder argument that returns a FluentTextSelectionToolbar
  4. In this FluentTextSelectionToolbar, pass one or more ContextMenuButtonItem items to the buttonItems argument, setting the type to either lookUp, searchWeb or share
  5. When oppening the menu, the item won't be there

Expected behavior
The item should appear in the context menu for the selected text

Additional context
The issue seems to be on line 134 to 161 of file selection_controls.dart (as of version 4.15). The list of items is filtered into an orderedButtons variable and only the cited types are taken into account. Any types not in this list are simply not included.

To make things worse, this same file seems to take these extra types into account for other methods like contextMenuTypeToShortcut and contextMenuTypeToIcon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions