Skip to content

Move preconditionFn to CoreRegistryItem #9179

@rpbourret

Description

@rpbourret

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

PR 8767 added separators to context menus. It did this by refactoring RegistryItem into ActionRegistryItem and SeparatorRegistryItem, both of which extend CoreRegistryItem. It placed preconditionFn in ActionRegistryItem and scopeType in CoreRegistryItem.

PR 8882 deprecated scopeType in favor of a Scope object passed to preconditionFn. This allowed menu items to apply to any IFocusableNode, instead of just workspaces, blocks, and comments.

As a result, separator menu items must use the deprecated scopeType property to specify what component they apply to, while action menu items can use preconditionFn. This results in two problems:

  • If scopeType is ever removed, it won't be possible to specify what components separator menu items apply to.
  • Separator menu items can only apply to workspaces, blocks, and comments, while action menu items can apply to any IFocusableNode.

The solution is to move preconditionFn from ActionRegistryItem to CoreRegistryItem.

Reproduction steps

Stack trace

Screenshots

No response

Browsers

No response

Metadata

Metadata

Assignees

Labels

issue: bugDescribes why the code or behaviour is wrong

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions