Skip to content

Unify and improve "copy to clipboard" interactions #8621

Description

@odzhychko

Is your feature request related to a problem? Please describe.

In many place a user can copy something to a clipboard.

Currently they have the issues of:

Describe the solution you'd like

  1. Decide on consistent UI/UX patterns
  2. Use consistent UI/UX patterns
  3. Encapsulate UI/UX patterns in reusable components
  4. Share copy-handling code between components

Describe alternatives you've considered

No response

Additional context

Having shared logic, we could write more elaborate copy-handling code supporting more browsers.

Simple module exposing an async copy function that uses the Async Clipboard API (navigator.clipboard) in secure contexts (HTTPS / localhost), with automatic fallback to document.execCommand('copy') for non-secure contexts or older browsers.

https://www.npmjs.com/package/copy-to-clipboard

Might use contribute back to https://github.com/nextcloud-libraries/nextcloud-vue/blob/f460a5c48898a9cebc656923b9c0ac4ffb969851/src/composables/useCopy.ts

Changing the button icon in place for a few seconds in case of success seems to be a very common pattern.
If no icon is used button text can change from "Copy text" to "Copied!" for a second or so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. to triagePending approval or rejectiondesignRelated to design, interface, interaction design, UX, etc.enhancementNew feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions