-
Notifications
You must be signed in to change notification settings - Fork 734
Description
Summary
The Command.Select, Selecting event, and related APIs (OnSelecting, RaiseSelecting) should be renamed to Command.Activate, Activating event, OnActivating, and RaiseActivating to improve clarity and consistency in the Command system. The term "select" is ambiguous for stateless views (e.g., Button, MenuItemv2, where it only sets focus) and less precise for non-list-based state changes (e.g., toggling a CheckBox). "Activate" better captures the action of changing a view’s state or preparing it for interaction, aligning with both stateful (e.g., CheckBox, FlagSelector, ListView) and stateless (e.g., Button, MenuItem) use cases while clearly distinguishing from Accepting.
Motivation
The current Command.Select and Selecting terminology has several issues:
- Ambiguity in Stateless Views: For views like
ButtonorMenuItem,Command.Selectonly sets focus, which isn’t typically considered “selection,” leading to developer confusion. - Imprecise for Non-List Contexts: In
CheckBox(toggling state) orFlagSelector(toggling flags), “select” doesn’t fully capture the state change, unlike list-based selection inListView. - Overlap with Accepting: In views like
ListVieworMenu,SelectingandAcceptingcan feel similar (e.g., Enter triggering both), requiring clearer distinction. - Propagation Needs:
MenuBarrequiresActivatingevents from subviews to managePopoverMenuvisibility, but the current local handling model relies on view-specific events (e.g.,SelectedMenuItemChanged), which isn’t generalizable. Subviews should remain decoupled from superviews, avoiding knowledge of superview implementation details (e.g.,MenuBar’s popover logic).
The Activate terminology addresses these by:
- Representing both state changes (e.g., toggling a
CheckBox, selecting aListViewitem) and preparatory actions (e.g., focusing aButton, navigating aMenuItemv2). - Distinguishing clearly from
Accepting, which confirms actions (e.g., executing a menu command, submitting a dialog). - Supporting a targeted propagation model with
PropagateActivating, enabling superviews likeMenuBarto opt-in to subviewActivatingevents without coupling subviews to superview details.
Proposed Changes
1. Rename Command.Select and Related APIs to Activate
- Rename
Command.SelecttoCommand.Activatein theCommandenum. - Rename
Selectingevent toActivating,OnSelectingtoOnActivating, andRaiseSelectingtoRaiseActivatingin theViewclass and all derived classes (e.g.,Menuv2,MenuItemv2,CheckBox,FlagSelector). - Update related code:
- Modify
SetupCommandsinViewto useCommand.Activate. - Update
Shortcut.DispatchCommandand other command handlers to referenceActivating. - Ensure all event handlers and documentation reflect the new terminology.
- Ensure all tests are appropriately renamed and updated
- Modify
Related
Metadata
Metadata
Labels
Type
Projects
Status