Skip to content

Bug: the copy functionality of ReadOnlyField doesn't work at all if you disable the confirmation toast #978

Closed
@marcopiii

Description

@marcopiii

Description of the bug

When using ReadOnlyField with withCopyButton: true you get a confirmation toast out of the box when the user clicks the copy button. If you don't want to use the toast, you can also pass showToastOnCopy: false, but this also disables the copy function.
This behavior is visible in the source code

onPress={async () => {
if (props.showToastOnCopy ?? true) {
try {
await navigator.clipboard.writeText(props.value);
showToast({
kind: "informative",
message: props.copySuccessMessage,
dismissable: true,
});
} catch {
console.error("Could not copy to clipboard");
}
}
}}

Moreover, it is also weird that copySuccessMessage is required even if you set showToastOnCopy: false.

Playroom reproduction

No response

Version

latest

What browsers are you seeing the problem on?

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions