Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions docs/design/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ There are three steps to add keyboard shortcuts to an add-in.

## Prerequisites

Keyboard shortcuts are currently only supported in the following platforms and build of **Excel** and **Word**.
Keyboard shortcuts are supported in the following platforms and build of **Excel**, **PowerPoint**, **Word**.

- Office on the web
- Office on Windows
- **Excel**: Version 2102 (Build 13801.20632) and later
- **PowerPoint**: Version 2601 (Build 19628.20150) and later
- **Word**: Version 2408 (Build 17928.20114) and later
- Office on Mac
- **Excel**: Version 16.55 (21111400) and later
- **PowerPoint**: Version 16.105.2 (26012530) and later
- **Word**: Version 16.88 (24081116) and later

Additionally, keyboard shortcuts only work on platforms that support the following requirement sets. For information about requirement sets and how to work with them, see [Specify Office applications and API requirements](../develop/specify-office-hosts-and-api-requirements.md).
Expand Down Expand Up @@ -247,14 +249,22 @@ Use the following guidelines to create custom key combinations for your add-ins.

### Browser shortcuts that can't be overridden

> [!NOTE]
> In Office on the web, custom keyboard shortcuts don't work when the task pane has focus. Keyboard shortcuts are only triggered when focus is on the document, presentation, or spreadsheet.

When using custom keyboard shortcuts on the web, some keyboard shortcuts that are used by the browser can't be overridden by add-ins. The following list is a work in progress. If you discover other combinations that can't be overridden, please let us know by using the feedback tool at the bottom of this page.

- <kbd>Ctrl</kbd>+<kbd>N</kbd>
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd>
- <kbd>Ctrl</kbd>+<kbd>T</kbd>
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd>
- <kbd>Ctrl</kbd>+<kbd>W</kbd>
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd>
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd>
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>
- <kbd>Ctrl</kbd>+<kbd>PgUp</kbd>/<kbd>PgDn</kbd>
- <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd>
- <kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd>

### Avoid key combinations in use by other add-ins

Expand All @@ -269,14 +279,24 @@ In the case of a conflict, the user will see a dialog box the first time they at

The user can select which action the keyboard shortcut will take. After making the selection, the preference is saved for future uses of the same shortcut. The shortcut preferences are saved per user, per platform. If the user wishes to change their preferences, they can invoke the **Reset Office Add-ins shortcut preferences** command from the **Tell me** search box. Invoking the command clears all of the user's add-in shortcut preferences and the user will again be prompted with the conflict dialog box the next time they attempt to use a conflicting shortcut.

> [!NOTE]
> In PowerPoint, if a user chooses the action defined by PowerPoint in the conflict dialog, then selects **OK**, the action won't run immediately. The user must press the key combination again after the dialog closes for the action to take effect.

:::image type="content" source="../images/add-in-reset-shortcuts-action.png" alt-text="The Tell me search box in Excel showing the reset Office Add-in shortcut preferences action.":::

For the best user experience, we recommend that you minimize keyboard shortcut conflicts with these good practices.

- Use only keyboard shortcuts with the following pattern: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+*x*, where *x* is some other key.
- Avoid using established keyboard shortcuts in Excel and Word. For a list, see the following:
- Avoid using established keyboard shortcuts in Excel, PowerPoint, and Word. For a list, see the following:
- [Keyboard shortcuts in Excel](https://support.microsoft.com/office/1798d9d5-842a-42b8-9c99-9b7213f0040f)
- [Keyboard shortcuts in PowerPoint](https://support.microsoft.com/office/ebb3d20e-dcd4-444f-a38e-bb5c5ed180f4)
- [Keyboard shortcuts in Word](https://support.microsoft.com/office/95ef89dd-7142-4b50-afb2-f762f663ceb2)
- In Office on the web, don't use the following shortcuts as your add-in's custom shortcuts.
- <kbd>Ctrl</kbd>+<kbd>X</kbd> (Cut)
- <kbd>Ctrl</kbd>+<kbd>C</kbd> (Copy)
- <kbd>Ctrl</kbd>+<kbd>V</kbd> (Paste)

These shortcuts can't be overridden. Only the host application's implementation of these shortcuts works.
- When the keyboard focus is inside the add-in UI, <kbd>Ctrl</kbd>+<kbd>Space</kbd> and <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F10</kbd> won't work as these are essential accessibility shortcuts.
- On a Windows or Mac computer, if the **Reset Office Add-ins shortcut preferences** command isn't available on the search menu, the user can manually add the command to the ribbon by customizing the ribbon through the context menu.

Expand Down Expand Up @@ -438,7 +458,7 @@ Office.actions.areShortcutsInUse(shortcuts)

## Implement custom keyboard shortcuts across supported Microsoft 365 apps

You can implement a custom keyboard shortcut to be used across supported Microsoft 365 apps, such as Excel and Word. If the implementation to perform the same task is different on each app, you must use the `Office.actions.associate` method to call a different callback function for each app. The following code is an example.
You can implement a custom keyboard shortcut to be used across supported Microsoft 365 apps, such as Excel, PowerPoint, and Word. If the implementation to perform the same task is different on each app, you must use the `Office.actions.associate` method to call a different callback function for each app. The following code is an example.

```javascript
const host = Office.context.host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Configuring a shared runtime enables the following scenarios.
- [Change the availability of add-in commands](../design/disable-add-in-commands.md)
- [Run code in your Office Add-in when the document opens](run-code-on-document-open.md)
- [Show or hide the task pane of your Office Add-in](show-hide-add-in.md)
- [Add custom keyboard shortcuts to your Office Add-ins](../design/keyboard-shortcuts.md) (supported in Excel and Word add-ins only)
- [Add custom keyboard shortcuts to your Office Add-ins](../design/keyboard-shortcuts.md) (supported in Excel, PowerPoint, and Word add-ins)
- The following are available for Excel add-ins only.
- [Create custom contextual tabs in Office Add-ins](../design/contextual-tabs.md)
- Custom functions will have full CORS support.
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/develop-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ An Office Add-in's manifest defines the settings and capabilities of the add-in.
- Location of images that the add-in uses for branding and command iconography.
- Dimensions of the add-in (for example, dimensions for content add-ins, requested height for Outlook add-ins).
- Rules that specify when the add-in activates in the context of a message or appointment (for Outlook add-ins only).
- Keyboard shortcuts (for Excel and Word add-ins only).
- Keyboard shortcuts (for Excel, PowerPoint, and Word add-ins only).

For detailed information about the manifest, see [Office Add-ins manifest](add-in-manifests.md).

Expand Down