Skip to content

[Web Outlook] Task Pane addin does not support Clipboard API #1991

Description

@Aidam1

Provide required information needed to triage your issue

I would like to use Clipboard API to copy text on button click in web Outlook taskpane addin. However, it is currently blocked because the containing iframe doesn't have necessary permissions.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Operating System: Windows 10
  • Browser (if using Office on the web): Google Chrome Version 91.0.4472.124

Expected behavior

The Clipboard API is allowed and I'm able to use it.

Current behavior

The addin is in an iframe without necessary permissions, it is currently impossible to copy text through Clipboard API. After I try to use it, the console writes:
Uncaught (in promise) DOMException: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://goo.gl/EuHzyv for more details.

The solution would be to add more permissions to the iframe by passing clipboard-write permission to iframe. More info for example here: https://web.dev/async-clipboard/#permissions-policy-integration

Steps to reproduce

  1. In any react component, write onClick prop: onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}}
  2. Go to pane and try to click on the component

Metadata

Metadata

Labels

Area: OutlookIssue related to Outlook add-insType: product feature requestOffice JS ideas that should be posted to aka.ms/m365dev-suggestions (formerly User Voice.)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions