Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore ClipboardButton to work in non-secure contexts. #19654

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

dennisoelkers
Copy link
Member

Note: This needs a backport to 6.0.

Description

Motivation and Context

This PR is restoring ClipboardButton's functionality to work in non-secure context. In a previous refactoring (#17472), the component was made to use CopyButton from Mantine, which works only in secure contexts (+ localhost), unfortunately. This PR is now restoring it by removing the usage of Mantine's CopyButton and implements an own component for this, which uses our own copyToClipboard abstraction, which falls back to a legacy approach in non-secure contexts.

Fixes #19643.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@dennisoelkers dennisoelkers requested a review from a team June 17, 2024 06:57
import { CopyButton, Tooltip } from '@mantine/core';
import * as React from 'react';
import { useCallback, useState } from 'react';
import { Tooltip } from '@mantine/core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use our abstraction from common/Tooltip here.

@dennisoelkers dennisoelkers merged commit 11fcde9 into master Jun 18, 2024
6 checks passed
@dennisoelkers dennisoelkers deleted the fix/issue-19643 branch June 18, 2024 06:09
dennisoelkers added a commit that referenced this pull request Jun 18, 2024
* Restore `ClipboardButton` to work in non-secure contexts.

* Adding changelog snippet.

* Better changelog messages.

* Using `Tooltip` abstraction.
linuspahl pushed a commit that referenced this pull request Jun 18, 2024
…19665)

* Restore `ClipboardButton` to work in non-secure contexts.

* Adding changelog snippet.

* Better changelog messages.

* Using `Tooltip` abstraction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants