Skip to content

Copy keyboard shortcut throws an error in Firefox #1526

Backlog

Description

@avispeng

material-react-table version

v3.2.1

react & react-dom versions

v19.3.1

Describe the bug and the steps to reproduce it

When left enableKeyboardShortcuts unchanged, which is true by default, select text in a cell, and CTRL+C, an error will be thrown Uncaught (in promise) DOMException: Clipboard write is not allowed.. The text is copied in clipboard despite the error.

I can confirm the issue is in Firefox + Windows. Chrome and Edge in Windows don't have this issue. My Firefox is up to date (161.0 (64-bit)).

A bit more into this, Firefox seems to cancel MRT's navigator.clipboard.writeText(cellValue) in cellKeyboardShortcuts() and use browser's native copy. When I select partial text in a cell, and check my clipboard, only selected text is actually copied. In Chrome where there is no error, entire cell is always copied regardless of selected text, which is the expected behaviour from MRT's copy keyboard shortcut.

Minimal, Reproducible Example - (Optional, but Recommended)

We can test the behaviour using "Basic Example" in MRT doc https://www.material-react-table.com/docs/examples/basic

In Firefox on Windows, select cell text, and CTRL+C, then check console and there should be an error Uncaught (in promise) DOMException: Clipboard write is not allowed..

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No response

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions