Windows 11 brings refinement to contextual file operations in the right-click context menu and share dialog. These are extensible by apps, including unpackaged Win32 apps.
The context menu is one of the most popular and useful shell extensions. If you are already in File Explorer or on the Desktop, it significantly reduces the number of steps to complete a file operation compared to opening a separate app.
As useful as the Windows 10 context menu is, there are aspects of its design we sought to improve in Windows 11.
- The most common commands – cut, copy, paste, delete, and rename – are far from the mouse pointer, touch point, or pen.
- The menu is exceptionally long. It has grown in an unregulated environment for 20 years, since Windows XP, when IContextMenu was introduced.
- It includes commands which are rarely used.
- Commands that should be grouped together – such as Open and Open with – are sometimes far apart.
- Commands added by apps have no common organizational schema and can interrupt sections of inbox commands.
- Commands added by apps are not attributable to the app itself.
- Many commands run in-process in Explorer, which can cause performance and reliability issues.
The Windows 11 context menu addresses these problems in the following ways:
Common commands are placed right next to where the menu is invoked.
“Open” and “Open with” are grouped together.
Apps extend the menu with IExplorerCommand + app identity. Unpackaged Win32 apps can use Sparse Manifests. IExplorerCommand support extends back to Windows 7.
App extensions are grouped together below Shell verbs.
Cloud Files provider apps are placed next to the Shell commands to hydrate or dehydrate the file.
Apps with more than 1 verb are grouped into a flyout with app attribution.
“Show more options” loads the Windows 10 context menu as-is for access to low-use Shell verbs and apps still working on porting over. No commands have been removed entirely.
- Shift-F10 or the keyboard menu key will also load the Windows 10 context menu.
The share dialog has also been improved in Windows 11.
Nearby sharing is now much easier to use, with easy control over your discoverability setting up top and a link to more settings in the footer of the dialog.
If you use the Mail app, the first entry in the contacts list helps you easily send an email to yourself.
- All apps can now participate in the Share dialog as targets. For unpackaged Win32 apps, this is covered in the same sample as the context menu. PWAs installed through Microsoft Edge are also supported if they implement the Web Share Target API.
Context Menu Best Practices
Regarding File Opening scenarios:
1. When should I register my app for “Open with”? (File Type associations)
The new context menu moves “Open with” to the top of the menu, right next to “Open.”
If your app can open the file to do something more with it, you should always register for any applicable File Type Associations.
“Universal openers,” like technical text editors, should register to handle * so they will always be offered as an “Open with” option. They should also explicitly register for any filetypes they are optimized to handle.
2. When should I add a verb to “Edit with〈app〉”?
It is common for certain file types to be both “viewable/runnable” and “editable,” such as scripts, HTML, images, or text-based document formats.
Because the default action on double-click for these files can be “open/run” or “edit,” one of these two actions will be less convenient.
In these cases, adding a verb for “Edit with〈app name〉” is an acceptable practice.
However, please consider if your non-power-users will be adequately served by “Open with.”
For these users, a default state of not including the verb unless users opt into it will keep the menu tidier in general while offering classic functionality to your power users.
Regarding File Sharing scenarios:
3. When should I add a Context Menu verb to “Share with〈app〉”?
Share actions can originate outside of File Explorer, for example the Photos app or Snip & Sketch. In these cases, the Share dialog is shown to the user.
The best practice is to make sure you are registered as an app target in the Share dialog.
It’s also OK to add a Context Menu verb for “Share with〈app〉”
Because the Share dialog is also easily accessed from the File Explorer ribbon and context menu, an additional “Share with” verb in the context menu can be redundant – consider offering a way for users to opt out of the duplicate context menu verb.
Source: Windows Blog